Estimated Notebook Runtime: 2m 19s

Prelim info¶

Objective¶

  • financial consultancy firm
  • provide investment strategies
  • data (stock price, financial indicators) for some NYSE-listed listed companies
  • TODO
    • analyze data,
    • group stocks by attributes,
    • give insights on characteristics of each group

Data Dictionary¶

  • Ticker Symbol: abbrev to id shares of a stock on stock market
  • Company: Name
  • GICS Sector: economic sector assigned to by Global Industry Classification Standard (GICS) defines business operations
  • GICS Sub Industry: sub-industry group assigned by Global Industry Classification Standard (GICS) defines business operations
  • Current Price: Current stock price (dollars)
  • Price Change: % change in stock price in 13 weeks
  • Volatility: St dev of stock price over past 13 weeks
  • ROE: measure of financial performance (net income / shareholders' equity)
    • (shareholders' equity = assets - debt)
  • Cash Ratio: total reserves of cash, cash equivalents / total current liabilities
  • Net Cash Flow: cash inflows - outflows (in dollars)
  • Net Income: Revenues - expenses, interest, and taxes (in dollars)
  • Earnings Per Share: net profit / number of common shares outstanding (dollars)
  • Estimated Shares Outstanding: stock currently held by all shareholders
  • P/E Ratio: current stock price / earnings per share
  • P/B Ratio: stock price per share / book value per share (book value = total assets - total liabilities)

Prelim analysis¶

In [1]:
import numpy as np
import pandas as pd
data = pd.read_csv('../data/stock_data.csv')
data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 340 entries, 0 to 339
Data columns (total 15 columns):
 #   Column                        Non-Null Count  Dtype  
---  ------                        --------------  -----  
 0   Ticker Symbol                 340 non-null    object 
 1   Security                      340 non-null    object 
 2   GICS Sector                   340 non-null    object 
 3   GICS Sub Industry             340 non-null    object 
 4   Current Price                 340 non-null    float64
 5   Price Change                  340 non-null    float64
 6   Volatility                    340 non-null    float64
 7   ROE                           340 non-null    int64  
 8   Cash Ratio                    340 non-null    int64  
 9   Net Cash Flow                 340 non-null    int64  
 10  Net Income                    340 non-null    int64  
 11  Earnings Per Share            340 non-null    float64
 12  Estimated Shares Outstanding  340 non-null    float64
 13  P/E Ratio                     340 non-null    float64
 14  P/B Ratio                     340 non-null    float64
dtypes: float64(7), int64(4), object(4)
memory usage: 40.0+ KB

list 4 object columns¶

In [2]:
object_list=[]
for col in data.columns:
    if data[col].dtype == 'object':
        object_list.append(col)
        # data = data.fillna(data.mode().iloc[0])
In [3]:
object_list
Out[3]:
['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry']

Import libraries¶

In [4]:
# Libraries to help with reading and manipulating data
import numpy as np
import pandas as pd

# Libraries to help with data visualization
import matplotlib.pyplot as plt
import seaborn as sns

sns.set_theme(style='darkgrid')

# Removes the limit for the number of displayed columns
pd.set_option("display.max_columns", None)
# Sets the limit for the number of displayed rows
pd.set_option("display.max_rows", 200)

# to scale the data using z-score
from sklearn.preprocessing import StandardScaler

# to compute distances
from scipy.spatial.distance import cdist, pdist

# to perform k-means clustering and compute silhouette scores
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score

# to visualize the elbow curve and silhouette scores
from yellowbrick.cluster import KElbowVisualizer, SilhouetteVisualizer

# to perform hierarchical clustering, compute cophenetic correlation, and create dendrograms
from sklearn.cluster import AgglomerativeClustering
from scipy.cluster.hierarchy import dendrogram, linkage, cophenet

# to suppress warnings
import warnings
warnings.filterwarnings("ignore")

runtime of above: ~ 2.3 to 52.6 s

In [5]:
# ChatGPT3 recommended libraries:
from scipy.spatial.distance import pdist, squareform

# https://docs.xlwings.org/en/latest/jupyternotebooks.html
from xlwings import view
from xlwings import load

Load data¶

In [6]:
data = pd.read_csv('../data/stock_data.csv')

Data Overview¶

Data Overview: initial steps:¶

data:¶

  • data .head() or .shape() to check loaded
  • data.shape[0] -> rows, data.shape[1] -> cols
  • col data types, check in preferred format, value of each property is as expected
  • check statistical summary of data, get overview of numerical cols
In [7]:
data.head(2)
Out[7]:
Ticker Symbol Security GICS Sector GICS Sub Industry Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio
0 AAL American Airlines Group Industrials Airlines 42.349998 9.999995 1.687151 135 51 -604000000 7610000000 11.39 6.681299e+08 3.718174 -8.784219
1 ABBV AbbVie Health Care Pharmaceuticals 59.240002 8.339433 2.197887 130 77 51000000 5144000000 3.15 1.633016e+09 18.806350 -8.750068

Check data shape¶

In [8]:
# checking shape of the data
print(f"There are {data.shape[0]} rows and {data.shape[1]} columns.") ## Complete the code to get the shape of data
There are 340 rows and 15 columns.

Show few rows of data¶

In [9]:
# let's view a sample of the data
data.sample(n=4, random_state=1)
Out[9]:
Ticker Symbol Security GICS Sector GICS Sub Industry Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio
102 DVN Devon Energy Corp. Energy Oil & Gas Exploration & Production 32.000000 -15.478079 2.923698 205 70 830000000 -14454000000 -35.55 4.065823e+08 93.089287 1.785616
125 FB Facebook Information Technology Internet Software & Services 104.660004 16.224320 1.320606 8 958 592000000 3669000000 1.31 2.800763e+09 79.893133 5.884467
11 AIV Apartment Investment & Mgmt Real Estate REITs 40.029999 7.578608 1.163334 15 47 21818000 248710000 1.52 1.636250e+08 26.335526 -1.269332
248 PG Procter & Gamble Consumer Staples Personal Products 79.410004 10.660538 0.806056 17 129 160383000 636056000 3.28 4.913916e+08 24.070121 -2.256747

data type per col¶

data.info()¶

In [10]:
# checking the column names and datatypes
data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 340 entries, 0 to 339
Data columns (total 15 columns):
 #   Column                        Non-Null Count  Dtype  
---  ------                        --------------  -----  
 0   Ticker Symbol                 340 non-null    object 
 1   Security                      340 non-null    object 
 2   GICS Sector                   340 non-null    object 
 3   GICS Sub Industry             340 non-null    object 
 4   Current Price                 340 non-null    float64
 5   Price Change                  340 non-null    float64
 6   Volatility                    340 non-null    float64
 7   ROE                           340 non-null    int64  
 8   Cash Ratio                    340 non-null    int64  
 9   Net Cash Flow                 340 non-null    int64  
 10  Net Income                    340 non-null    int64  
 11  Earnings Per Share            340 non-null    float64
 12  Estimated Shares Outstanding  340 non-null    float64
 13  P/E Ratio                     340 non-null    float64
 14  P/B Ratio                     340 non-null    float64
dtypes: float64(7), int64(4), object(4)
memory usage: 40.0+ KB

Create copy of original data¶

In [11]:
# copying the data to another variable to avoid any changes to original data
df = data.copy()

Check for duplicates and missing values¶

df.duplicated().sum() = 0¶

In [12]:
# checking for duplicate values
df.duplicated().sum() ## Complete the code to get total number of duplicate values
Out[12]:
0

df.isna().sum() = 0 / each col¶

In [13]:
def isna_checker():
    """
    function to check if the count in each col of data is 0. 
    """
    df_isna=df.isna().sum() # full dataframe
    found_na=False
    for i in df_isna.keys(): # take 1 key at a time out of just the keys
        if df_isna==0:
            pass
    # inform user
    if found_na==False:
        print('no na values in data')
    else:
        print('the following columns have na values:')
        

end of section: df.isna().sum() = 0 / each col¶

GitHub milestones¶

Project milestones Creating and editing milestones for issues and pull requests

About milestones

Put na counts keys and values in a dictionary¶
In [14]:
object_na_counts={}
df_isna=df.isna().sum()
dnaky=df_isna.keys()
dnavl=df_isna.array
for index, col_na_count in enumerate(df_isna):
    # print(index)
    object_na_counts.update({dnaky[index]:dnavl[index]})
object_na_counts
# reference: [pandas.DataFrame.values](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.values.html)
# reference: [pandas.Series.array](https://pandas.pydata.org/docs/reference/api/pandas.Series.array.html#pandas.Series.array)
# dnavl[0]
Out[14]:
{'Ticker Symbol': 0,
 'Security': 0,
 'GICS Sector': 0,
 'GICS Sub Industry': 0,
 'Current Price': 0,
 'Price Change': 0,
 'Volatility': 0,
 'ROE': 0,
 'Cash Ratio': 0,
 'Net Cash Flow': 0,
 'Net Income': 0,
 'Earnings Per Share': 0,
 'Estimated Shares Outstanding': 0,
 'P/E Ratio': 0,
 'P/B Ratio': 0}
get .keys() for na_count (per column) dictionary:¶
In [15]:
object_na_counts.keys()
Out[15]:
dict_keys(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry', 'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio', 'Net Cash Flow', 'Net Income', 'Earnings Per Share', 'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio'])
get .values() for na_count (per column) dictionary:¶
In [16]:
object_na_counts.values()
Out[16]:
dict_values([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
  • dict.values returns dict-value object, not list object

    • set-like object, uses hash table to store items, not suitable for indexing
    • supports most of set attributes, optimized for ops like membership checking (using in operator).
  • Answer: If you want to get a list object, you need to convert it to list by passing the result to the list() function.

  • Code:

      the_values = dict.values()
      SUM = sum(list(the_values)[1:10])

Python: how to convert a dictionary into a subscriptable array?

To check no na values [Resolved]:¶
In [17]:
sum_object_na_counts=0
for index, value in enumerate(object_na_counts.values()):
    sum_object_na_counts+=list(object_na_counts.values())[index]
if (sum_object_na_counts==0):
    print("no na values in dataframe")
no na values in dataframe

Statistical summary¶

In [18]:
df.describe(include='all').T
Out[18]:
count unique top freq mean std min 25% 50% 75% max
Ticker Symbol 340 340 AAL 1 NaN NaN NaN NaN NaN NaN NaN
Security 340 340 American Airlines Group 1 NaN NaN NaN NaN NaN NaN NaN
GICS Sector 340 11 Industrials 53 NaN NaN NaN NaN NaN NaN NaN
GICS Sub Industry 340 104 Oil & Gas Exploration & Production 16 NaN NaN NaN NaN NaN NaN NaN
Current Price 340.0 NaN NaN NaN 80.862345 98.055086 4.5 38.555 59.705 92.880001 1274.949951
Price Change 340.0 NaN NaN NaN 4.078194 12.006338 -47.129693 -0.939484 4.819505 10.695493 55.051683
Volatility 340.0 NaN NaN NaN 1.525976 0.591798 0.733163 1.134878 1.385593 1.695549 4.580042
ROE 340.0 NaN NaN NaN 39.597059 96.547538 1.0 9.75 15.0 27.0 917.0
Cash Ratio 340.0 NaN NaN NaN 70.023529 90.421331 0.0 18.0 47.0 99.0 958.0
Net Cash Flow 340.0 NaN NaN NaN 55537620.588235 1946365312.175789 -11208000000.0 -193906500.0 2098000.0 169810750.0 20764000000.0
Net Income 340.0 NaN NaN NaN 1494384602.941176 3940150279.327936 -23528000000.0 352301250.0 707336000.0 1899000000.0 24442000000.0
Earnings Per Share 340.0 NaN NaN NaN 2.776662 6.587779 -61.2 1.5575 2.895 4.62 50.09
Estimated Shares Outstanding 340.0 NaN NaN NaN 577028337.75403 845849595.417695 27672156.86 158848216.1 309675137.8 573117457.325 6159292035.0
P/E Ratio 340.0 NaN NaN NaN 32.612563 44.348731 2.935451 15.044653 20.819876 31.764755 528.039074
P/B Ratio 340.0 NaN NaN NaN -1.718249 13.966912 -76.119077 -4.352056 -1.06717 3.917066 129.064585
object_list for object type columns¶

Tabnine/GitHub CoPilot assisted sentence completion in the next couple of markdown cells.:

statistical summary using describe() method:¶

(and .T to transpose dataframe for readability),

observations:¶
  1. Many NaN (Not a Number) values in data
  • However, NaN's in 1st 4 columns (not numerical)
Flagged 4 features, passed them to object_list for ease of reference, as follows:¶
In [19]:
object_list
Out[19]:
['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry']
  1. For the 3 columns:

    • unique
    • top and
    • freq

      all the numeric columns have NaN values.

      Explanation: 3 cols not applicable to numerical columns.

  • count is an integer for object columns, and a float for numeric columns.

  • Price Change, Net Cash Flow and Net Income have negative values, (not an issue as these values can be negative).

  • P/B Ratio has at least one negative value, however, from:

What is the Price to Book Ratio (P/B Ratio)? :

"A negative book value means that a company has more total liabilities than assets." (Mathematically possible, so not an issue with the data.)

Exploratory Data Analysis¶

Univariate analysis¶


matplotlib.pyplot.subplots / plt.subplots¶

For the univariate analysis: histogram boxplot was used.

The first line of code in the function starts with:

f2, (ax_box2, ax_hist2) = plt.subplots(

Here is the documentation for matplotlib.pyplot.subplots

which states that the purpose of the method is to:

"Create a figure and a set of subplots.

This utility wrapper makes it convenient to create common layouts of subplots, including the enclosing figure object, in a single call.

Returns:¶

fig : Figure

ax : Axes or array of Axes

  • ax can be either :

    • a single Axes object, or
    • an array of Axes objects
      • if more than one subplot was created.
    • The dimensions of the resulting array can be controlled with
      • the squeeze keyword, see above.
  • Typical idioms for handling the return value are:

===================================================

# using the variable ax for single a Axes
fig, ax = plt.subplots()

# using the variable axs for multiple Axes
fig, axs = plt.subplots(2, 2)

# using tuple unpacking for multiple Axes
fig, (ax1, ax2) = plt.subplots(1, 2)
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)

(The names ax and pluralized axs

  • are preferred over axes because for the latter
    • it's not clear if it refers to:
      • a single Axes instance or
      • a collection of these. )

end of notes on matplotlib.pyplot.subplots / plt.subplots¶


seaborn notes:¶

sns.boxplot¶

Reference: seaborn.boxplot / from VSCode mouseover function popup

seaborn.boxplot:

(function) def boxplot(
    data: Any | None = None,
    *,
    x: Any | None = None,
    y: Any | None = None,
    hue: Any | None = None,
    order: Any | None = None,
    hue_order: Any | None = None,
    orient: Any | None = None,
    color: Any | None = None,
    palette: Any | None = None,
    saturation: float = 0.75,
    width: float = 0.8,
    dodge: bool = True,
    fliersize: int = 5,
    linewidth: Any | None = None,
    whis: float = 1.5,
    ax: Any | None = None,
    **kwargs: Any
) -> Any

box plot (box-and-whisker plot):

  • shows distributions with respect to categories.

  • shows distribution of data for comparisons between variables. box shows quartiles of data, whiskers extend, show rest of distribution, except “outliers” found by a method that is a function of the inter-quartile range.

================================================================================

sns.histplot¶

Reference: seaborn.histplot / from VSCode mouseover function popup:

(function) def histplot(
    data: Any | None = None,
    *,
    x: Any | None = None,
    y: Any | None = None,
    hue: Any | None = None,
    weights: Any | None = None,
    stat: str = "count",
    bins: str = "auto",
    binwidth: Any | None = None,
    binrange: Any | None = None,
    discrete: Any | None = None,
    cumulative: bool = False,
    common_bins: bool = True,
    common_norm: bool = True,
    multiple: str = "layer",
    element: str = "bars",
    fill: bool = True,
    shrink: int = 1,
    kde: bool = False,
    kde_kws: Any | None = None,
    line_kws: Any | None = None,
    thresh: int = 0,
    pthresh: Any | None = None,
    pmax: Any | None = None,
    cbar: bool = False,
    cbar_ax: Any | None = None,
    cbar_kws: Any | None = None,
    palette: Any | None = None,
    hue_order: Any | None = None,
    hue_norm: Any | None = None,
    color: Any | None = None,
    log_scale: Any | None = None,
    legend: bool = True,
    ax: Any | None = None,
    **kwargs: Any
) -> Any

Plot univariate / bivariate histograms, show data distributions.

histogram: visualization of distribution of variable(s) by counting number of observations in bins

function can:

  • normalize statistic computed in each bin to estimate frequency, density or probability mass,
  • add smooth curve using kernel density estimate, similar to kdeplot().

(More info in user guide)

end of notes on seaborn¶


matplotlib.pyplot.axvline¶

present in code as: ax_hist2.axvline

Reference: -- | matplotlib.pyplot.axvline

Template: ## | matplotlib.pyplot.axvline(x=0, ymin=0, ymax=1, **kwargs)

Description: -| Add a vertical line across the Axes.

Parameters:¶

x float, default: 0 x position in data coordinates of the vertical line.

ymin float, default: 0 Should be between 0 and 1, 0 being the bottom of the plot, 1 the top of the plot.

ymax float, default: 1 Should be between 0 and 1, 0 being the bottom of the plot, 1 the top of the plot.

Returns:¶

Line2D

Other Parameters:¶

**kwargs Valid keyword arguments are Line2D properties, except for 'transform':

Property | # | Description

color or c | # | color

linestyle or ls | {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}

end of matplotlib.pyplot.axvline notes section¶

def histogram_boxplot():¶
In [20]:
# function to plot a boxplot and a histogram along the same scale.


def histogram_boxplot(df, feature, figsize=(8, 5), kde=False, bins=None):
    """
    Boxplot and histogram combined

    data: dataframe
    feature: dataframe column
    figsize: size of figure (default (12,7))
    kde: whether to the show density curve (default False)
    bins: number of bins for histogram (default None)
    """
    f2, (ax_box2, ax_hist2) = plt.subplots(
        nrows=2,  # Number of rows of the subplot grid= 2
        sharex=True,  # x-axis will be shared among all subplots
        gridspec_kw={"height_ratios": (0.25, 0.75)},
        figsize=figsize,
    )  # creating the 2 subplots
    sns.boxplot(
        data=df, x=feature, ax=ax_box2, showmeans=True, color="violet"
    )  # boxplot will be created and a star will indicate the mean value of the column
    sns.histplot(
        data=df, x=feature, kde=kde, ax=ax_hist2, bins=bins, palette="winter"
    ) if bins else sns.histplot(
        data=df, x=feature, kde=kde, ax=ax_hist2
    )  # For histogram
    ax_hist2.axvline(
        df[feature].mean(), color="green", linestyle="--"
    )  # Add mean to the histogram
    ax_hist2.axvline(
        df[feature].median(), color="black", linestyle="-"
    )  # Add median to the histogram

show histogram_boxplots:¶

output format: histogram with a single thin boxplot above to summarise the distribution.

Current Price¶
In [21]:
histogram_boxplot(df, 'Current Price')
Current stock price:¶
  • mainly in the $0 to $200 range
  • right skewed
    • outliers roughly above $200
      • up to $1200
call .describe() on ['Price Change'] column and explain output:¶
In [22]:
df['Current Price'].describe() # GitHub Copilot assisted line
Out[22]:
count     340.000000
mean       80.862345
std        98.055086
min         4.500000
25%        38.555000
50%        59.705000
75%        92.880001
max      1274.949951
Name: Current Price, dtype: float64
  • Max current stock price is $1274.95
  • Min current stock price is $4.50
    • this could be thought of as a so called penny stock.
      • the advantage of these stocks is that they can be purchased at a low price
        • however, one of the risks (as with any stock) is that the price can go to $0 resulting in total loss of investment, and potentially incurring liabilities exceeding initial investment, if leverage is used, which greatly increases risk.
  • mean current stock price is $80.86
  • one standard deviation in stock price is $98.06
  • the median is $59.71
  • Overall shape of the data:
    • with lon tail to the right,
      • tending to shift the mean upwards
  • combined with
  • mean (~81) being higher than median (~60)
  • are indicative of:
  • right skewed data for the df['Current Price'] Series/Column/Feature
Explore different methods to Compute Quantiles:¶
pandas.describe()¶

.describe()

used for calculating some statistical data like percentile, mean and std of the numerical values of the Series or DataFrame

Describe,sets%20of%20mixed%20data%20types.)

general form: DataFrame.describe(percentiles=None, include=None, exclude=None)

explanation:¶

Generate descriptive statistics.

  • e.g. summarize:
    • central tendency,
    • dispersion and
    • shape
      • of a dataset’s distribution,
      • excluding NaN values.

Analyzes:

  • both:
    • numeric and
    • object series,
  • and df col sets of mixed data types.

Output varies with input. See notes in docs,sets%20of%20mixed%20data%20types.) for more detail.

Parameters:¶

percentiles : list-like of numbers, optional

  • set output percentiles
  • All should be between 0 and 1.
    • Default: [.25, .5, .75]
      • returns 25th, 50th, and 75th percentiles

include : ‘all’, list-like of dtypes or None (default), optional

  • white list of data types to include in the result.
  • Ignored for Series.
  • Here are the options:

    • ‘all’ : All columns of the input will be included in the output.

    • A list-like of dtypes : Limits the results to the provided data types. To limit the result to numeric types submit numpy.number. To limit it instead to object columns submit the numpy.object data type. Strings can also be used in the style of select_dtypes (e.g. df.describe(include=['O'])). To select pandas categorical columns, use 'category'

    • None (default) : The result will include all numeric columns.

In [23]:
df['Current Price'].describe()
Out[23]:
count     340.000000
mean       80.862345
std        98.055086
min         4.500000
25%        38.555000
50%        59.705000
75%        92.880001
max      1274.949951
Name: Current Price, dtype: float64
In [24]:
df['Current Price'].describe().keys()
Out[24]:
Index(['count', 'mean', 'std', 'min', '25%', '50%', '75%', 'max'], dtype='object')
In [25]:
df['Current Price'].describe().keys()[0]
Out[25]:
'count'
In [26]:
IQR=[]
Q1=0
Q3=0
for x in df['Current Price'].describe().keys():
    if x== '25%':
        Q1=x
    if x == '75%':
        Q3=x
    IQR=[Q1,Q3]
    
# df['Current Price'].describe().keys()[i]
In [27]:
Q1=IQR[0]
Q3=IQR[1]
# IQR_no=Q1-Q3
In [28]:
Q1
Out[28]:
'25%'
In [29]:
for a in df['Current Price'].describe().keys():
    if a=='25%':
        Q1_val=(df['Current Price'].describe()[a])
In [30]:
Q1_val
Out[30]:
38.55499975
In [31]:
for a in df['Current Price'].describe().keys():
    if a=='75%':
        Q3_val=(df['Current Price'].describe()[a])
In [32]:
Q3_val
Out[32]:
92.88000124999999
In [33]:
IQR_val = Q3_val - Q1_val
In [34]:
IQR_val
Out[34]:
54.32500149999999

pandas.DataFrame.describe

In [35]:
df['Current Price'].describe()
Out[35]:
count     340.000000
mean       80.862345
std        98.055086
min         4.500000
25%        38.555000
50%        59.705000
75%        92.880001
max      1274.949951
Name: Current Price, dtype: float64
limit to 2 decimal places:¶

Limiting floats to two decimal points

References:

Format Specification Mini-Language

In [36]:
df['Current Price'].describe()
Out[36]:
count     340.000000
mean       80.862345
std        98.055086
min         4.500000
25%        38.555000
50%        59.705000
75%        92.880001
max      1274.949951
Name: Current Price, dtype: float64
In [37]:
round(Q1_val,3)
Out[37]:
38.555
In [38]:
Q1_val_round_3_to_2=round(Q1_val,3)
In [39]:
round(Q1_val_round_3_to_2,2) # rounds to 38.56
Out[39]:
38.56
In [40]:
round(Q1_val,2) # rounds to 38.55
Out[40]:
38.55
In [41]:
Q3_val_round_3_to_2=round(Q3_val,3)
In [42]:
round(Q3_val_round_3_to_2,2)
Out[42]:
92.88
In [43]:
round(round(Q3_val,3),2)
Out[43]:
92.88

text: *args allows us to pass a variable number of non-keyword arguments to a Python function.

code:

def add(*args):
    print(args, type(args))

add(2, 3)

How to Use *args and **kwargs in Python - freeCodeCamp

In [44]:
IQR_val
Out[44]:
54.32500149999999
In [45]:
def two_decimal_correct(*args):
    """
    pass *args as list
    takes floats
    returns list_of_outputs rounded to 2 decimal places
    Purpose of function:
    - to avoid error rounding from float to 2 decimal places
    - by first rounding to 3 and then to 2
    - which seems to fix bug of:
        - rounding directly to 2
        - can result in rounding down
        - even when next decimal place is >=5
    """
    list_of_outputs=[]
    for new_input in args:
        new_output=round(round(new_input,3),2)
        list_of_outputs.append(new_output)
    return list_of_outputs
In [46]:
two_decimal_correct(Q3_val, Q1_val, IQR_val)
Out[46]:
[92.88, 38.56, 54.32]
In [47]:
type(two_decimal_correct(Q3_val, Q1_val, IQR_val))
Out[47]:
list
In [48]:
type(IQR_val)
Out[48]:
numpy.float64
In [49]:
[IQR_val]
Out[49]:
[54.32500149999999]
In [50]:
two_decimal_correct(IQR_val)
Out[50]:
[54.32]

TODO: How to unpack list.

Reference: How to Unpack a List in Python

Code:

colors = ['red', 'blue', 'green']

red = colors[0]
blue = colors[1]
green = colors[2]
In [51]:
two_decimal_correct(IQR_val)[0]
Out[51]:
54.32
In [52]:
df['Current Price'].describe()
Out[52]:
count     340.000000
mean       80.862345
std        98.055086
min         4.500000
25%        38.555000
50%        59.705000
75%        92.880001
max      1274.949951
Name: Current Price, dtype: float64
In [53]:
print('The interquartile range (IQR) (Q3 - Q1) ({Q3_val_2:.2f}-{Q1_val_2:.2f}) (92.88 - 38.56) is $'.format(Q3_val_2=two_decimal_correct(Q3_val)[0],Q1_val_2=two_decimal_correct(Q1_val)[0]),'{IQR_val_2:.2f}'.format(IQR_val_2=two_decimal_correct(IQR_val)[0]))
The interquartile range (IQR) (Q3 - Q1) (92.88-38.56) (92.88 - 38.56) is $ 54.32
[Task:] Get IQR with pandas.¶
# Some test data
np.random.seed(33454)
df = (
    # A standard distribution
    pd.DataFrame({'nb': np.random.randint(0, 100, 20)})
        # Adding some outliers
        .append(pd.DataFrame({'nb': np.random.randint(100, 200, 2)}))
        # Reseting the index
        .reset_index(drop=True)
    )

# Computing IQR
Q1 = df['nb'].quantile(0.25)
Q3 = df['nb'].quantile(0.75)
IQR = Q3 - Q1

# Filtering Values between Q1-1.5IQR and Q3+1.5IQR
filtered = df.query('(@Q1 - 1.5 * @IQR) <= nb <= (@Q3 + 1.5 * @IQR)')

how to use pandas filter with IQR

In [54]:
df['Current Price'].quantile(0.25)
Out[54]:
38.55499975
Note:¶

As actual 1st quantile is 38.55499975, per df['Current Price'].quantile(0.25),

not 38.555000 per df['Current Price'].describe[4],

function: two_decimal_correct() is not needed,

as this function worked from the false assumption that

df['Current Price'].describe[4] was precisely correct to the number of decimal places shown.

However, it now appears that the reason the value was rounded down was that the actual value

was just under 38.555000 quoted by df['Current Price']

which explained why it rounded down for both {x.:f}.format() and round(x,2) formulae.

calculating quartiles:¶

bear in mind that there are 15 different ways to calculate quartiles.. so look under the hood as different functions may give slightly different results (pandas vs numpy vs scipy..) jse.amstat.org/v14n3/langford.html [1], [2]

In this paper, I will discuss the various methods, and using a precise definition (Definition 2) of percentile, identify that method which satisfies this definition. Unfortunately this method (the “CDF Method”) is not, in its usual form, the easiest for a student to apply. [2]

[1] How to calculate 1st and 3rd quartiles?

[2] Quartiles in Elementary Statistics

end of this section of calculating quartiles¶

calculating quantiles continued: Inverse CDF Method:¶
Inverse CDF (in the context of calculating quantiles)¶

search: the CDF Method for quantiles

reference: The Inverse CDF Method

explanation:

This ... math and probability post ... will talk about generating non-uniform random variables/numbers with the Inverse CDF Method [, which] involves computing quantiles from probabilities and using standard uniform random variables to generate non-uniform random variables.

This topic relates to Probability Theory, and Monte Carlo Simulations.

[1]

Aside: [1] references [2]

[1] Quartiles in Elementary Statistics

[2] Normal (Gaussian) Distribution | Boost C++ Libraries

[3] Boost C++ Libraries

end of limit to 2 decimal places section¶
end of Section: Explore different methods to Compute Quantiles¶

Price Change¶
In [55]:
histogram_boxplot(df, 'Price Change')  ## Complete the code to create histogram_boxplot for 'Price Change'
call .describe() on ['Price Change'] column and explain output:¶
In [56]:
df['Price Change'].describe()
Out[56]:
count    340.000000
mean       4.078194
std       12.006338
min      -47.129693
25%       -0.939484
50%        4.819505
75%       10.695493
max       55.051683
Name: Price Change, dtype: float64
  • mean Price Change was $4.08 across all 340 stocks.

df['Price Change'].mean() = 4.08

string formatting and casting to float not int:¶
floatNumber = 1.9876

print("%.1f" % floatNumber)
# 2.0

%.2f in Python – What does it Mean?

Want to cast to float not int To convert, or cast, a string to an integer in Python, you use the int() built-in function. Python Convert String to Int – How to Cast a String in Python%20.)

begin assembly of 5 explanatory lines on summary statistics (to be reused for each plot):¶

Convert a string to a number (int, float) in Python - nkmk note

In [57]:
float("%.2f" % df['Price Change'].mean()) # resolved: cast string to float
Out[57]:
4.08
In [58]:
print("mean of Price Change was $", float("%.2f" % df['Price Change'].mean()), sep='')
mean of Price Change was $4.08
In [59]:
print("median of Price Change was $", float("%.2f" % df['Price Change'].median()), sep='')
median of Price Change was $4.82
In [60]:
print("standard deviation for Price Change was $", float("%.2f" % df['Price Change'].std()), sep='')
standard deviation for Price Change was $12.01
In [61]:
print("minimum Price Change was $", float("%.2f" % df['Price Change'].min()), sep='')
minimum Price Change was $-47.13
In [62]:
print("maximum Price Change was $", float("%.2f" % df['Price Change'].max()), sep='')
maximum Price Change was $55.05
non-automated description of plot:¶

As median was slightly to the right of the mean, or mean left of median, the histogram was slightly left skewed, with slightly longer left tail, with more values in the tail further from the center.

This would indicate that there were more extremes of loss than of gain of these stocks over the 13 week period.

Volatility¶
In [63]:
feature='Volatility'
In [64]:
histogram_boxplot(df=df,feature='Volatility')  ## Complete the code to create histogram_boxplot for 'Volatility'
In [65]:
def function_arb(a,y):
    if y == '.mean()':
        return a.mean()
    elif y == '.median()':
        return a.median()
    elif y == '.std()':
        return a.std()
    elif y == '.min()':
        return a.min()
    elif y == '.max()':
        return a.max()
In [66]:
for x, y in zip(['mean', 'median', 'standard deviation', 'minimum', 'maximum'], ['.mean()', '.median()', '.std()', '.min()', '.max()']):
    a=df[feature]
    returned=function_arb(a,y)
    print(str("{x2} {feature_2} was $".format(x2=x,feature_2=feature)),float("%.2f" % returned))
mean Volatility was $ 1.53
median Volatility was $ 1.39
standard deviation Volatility was $ 0.59
minimum Volatility was $ 0.73
maximum Volatility was $ 4.58
ROE¶
In [67]:
feature='ROE'
In [68]:
histogram_boxplot(df=df,feature=feature)  ## Complete the code to create histogram_boxplot for 'ROE'
In [69]:
def function_arb(a,y):
    if y == '.mean()':
        return a.mean()
    elif y == '.median()':
        return a.median()
    elif y == '.std()':
        return a.std()
    elif y == '.min()':
        return a.min()
    elif y == '.max()':
        return a.max()
    
for x, y in zip(['mean', 'median', 'standard deviation', 'minimum', 'maximum'], ['.mean()', '.median()', '.std()', '.min()', '.max()']):
    a=df[feature]
    returned=function_arb(a,y)
    print(str("{x2} {feature_2} was $".format(x2=x,feature_2=feature)),float("%.2f" % returned))
mean ROE was $ 39.6
median ROE was $ 15.0
standard deviation ROE was $ 96.55
minimum ROE was $ 1.0
maximum ROE was $ 917.0
Cash Ratio¶
In [70]:
feature='Cash Ratio'
In [71]:
histogram_boxplot(df=df,feature=feature)  ## Complete the code to create histogram_boxplot for 'Cash Ratio'
In [72]:
def function_arb(a,y):
    if y == '.mean()':
        return a.mean()
    elif y == '.median()':
        return a.median()
    elif y == '.std()':
        return a.std()
    elif y == '.min()':
        return a.min()
    elif y == '.max()':
        return a.max()
    
for x, y in zip(['mean', 'median', 'standard deviation', 'minimum', 'maximum'], ['.mean()', '.median()', '.std()', '.min()', '.max()']):
    a=df[feature]
    returned=function_arb(a,y)
    print(str("{x2} {feature_2} was $".format(x2=x,feature_2=feature)),float("%.2f" % returned))
mean Cash Ratio was $ 70.02
median Cash Ratio was $ 47.0
standard deviation Cash Ratio was $ 90.42
minimum Cash Ratio was $ 0.0
maximum Cash Ratio was $ 958.0
Net Cash Flow¶
In [73]:
feature='Net Cash Flow'
In [74]:
histogram_boxplot(df=df,feature=feature)  ## Complete the code to create histogram_boxplot for 'Net Cash Flow'
In [75]:
def function_arb(a,y):
    if y == '.mean()':
        return a.mean()
    elif y == '.median()':
        return a.median()
    elif y == '.std()':
        return a.std()
    elif y == '.min()':
        return a.min()
    elif y == '.max()':
        return a.max()
    
for x, y in zip(['mean', 'median', 'standard deviation', 'minimum', 'maximum'], ['.mean()', '.median()', '.std()', '.min()', '.max()']):
    a=df[feature]
    returned=function_arb(a,y)
    print(str("{x2} {feature_2} was $".format(x2=x,feature_2=feature)),float("%.2f" % returned))
mean Net Cash Flow was $ 55537620.59
median Net Cash Flow was $ 2098000.0
standard deviation Net Cash Flow was $ 1946365312.18
minimum Net Cash Flow was $ -11208000000.0
maximum Net Cash Flow was $ 20764000000.0
Net Income¶
In [76]:
feature='Net Income'
In [77]:
histogram_boxplot(df=df,feature=feature)  ## Complete the code to create histogram_boxplot for 'Net Income'
In [78]:
def function_arb(a,y):
    if y == '.mean()':
        return a.mean()
    elif y == '.median()':
        return a.median()
    elif y == '.std()':
        return a.std()
    elif y == '.min()':
        return a.min()
    elif y == '.max()':
        return a.max()
    
for x, y in zip(['mean', 'median', 'standard deviation', 'minimum', 'maximum'], ['.mean()', '.median()', '.std()', '.min()', '.max()']):
    a=df[feature]
    returned=function_arb(a,y)
    print(str("{x2} {feature_2} was $".format(x2=x,feature_2=feature)),float("%.2f" % returned))
mean Net Income was $ 1494384602.94
median Net Income was $ 707336000.0
standard deviation Net Income was $ 3940150279.33
minimum Net Income was $ -23528000000.0
maximum Net Income was $ 24442000000.0
Earnings Per Share¶
In [79]:
feature='Earnings Per Share'
In [80]:
histogram_boxplot(df=df,feature=feature)  ## Complete the code to create histogram_boxplot for 'Earnings Per Share'
In [81]:
def function_arb(a,y):
    if y == '.mean()':
        return a.mean()
    elif y == '.median()':
        return a.median()
    elif y == '.std()':
        return a.std()
    elif y == '.min()':
        return a.min()
    elif y == '.max()':
        return a.max()
    
for x, y in zip(['mean', 'median', 'standard deviation', 'minimum', 'maximum'], ['.mean()', '.median()', '.std()', '.min()', '.max()']):
    a=df[feature]
    returned=function_arb(a,y)
    print(str("{x2} {feature_2} was $".format(x2=x,feature_2=feature)),float("%.2f" % returned))
mean Earnings Per Share was $ 2.78
median Earnings Per Share was $ 2.9
standard deviation Earnings Per Share was $ 6.59
minimum Earnings Per Share was $ -61.2
maximum Earnings Per Share was $ 50.09
Estimated Shares Outstanding¶
In [82]:
feature='Estimated Shares Outstanding'
In [83]:
histogram_boxplot(df=df,feature=feature)  ## Complete the code to create histogram_boxplot for 'Estimated Shares Outstanding'
In [84]:
def function_arb(a,y):
    if y == '.mean()':
        return a.mean()
    elif y == '.median()':
        return a.median()
    elif y == '.std()':
        return a.std()
    elif y == '.min()':
        return a.min()
    elif y == '.max()':
        return a.max()
    
for x, y in zip(['mean', 'median', 'standard deviation', 'minimum', 'maximum'], ['.mean()', '.median()', '.std()', '.min()', '.max()']):
    a=df[feature]
    returned=function_arb(a,y)/10e6
    print(str("{x2} {feature_2} was $".format(x2=x,feature_2=feature)),float("%.2f" % returned), ' million', sep='')
mean Estimated Shares Outstanding was $57.7 million
median Estimated Shares Outstanding was $30.97 million
standard deviation Estimated Shares Outstanding was $84.58 million
minimum Estimated Shares Outstanding was $2.77 million
maximum Estimated Shares Outstanding was $615.93 million
P/E Ratio¶
In [85]:
feature='P/E Ratio'
In [86]:
histogram_boxplot(df=df,feature=feature)  ## Complete the code to create histogram_boxplot for 'P/E Ratio'
In [87]:
def function_arb(a,y):
    if y == '.mean()':
        return a.mean()
    elif y == '.median()':
        return a.median()
    elif y == '.std()':
        return a.std()
    elif y == '.min()':
        return a.min()
    elif y == '.max()':
        return a.max()
    
for x, y in zip(['mean', 'median', 'standard deviation', 'minimum', 'maximum'], ['.mean()', '.median()', '.std()', '.min()', '.max()']):
    a=df[feature]
    returned=function_arb(a,y)
    print(str("{x2} {feature_2} was $".format(x2=x,feature_2=feature)),float("%.2f" % returned), sep='')
mean P/E Ratio was $32.61
median P/E Ratio was $20.82
standard deviation P/E Ratio was $44.35
minimum P/E Ratio was $2.94
maximum P/E Ratio was $528.04
P/B Ratio¶
In [88]:
feature='P/B Ratio'
In [89]:
histogram_boxplot(df=df,feature=feature)  ## Complete the code to create histogram_boxplot for 'P/B Ratio'
In [90]:
def function_arb(a,y):
    if y == '.mean()':
        return a.mean()
    elif y == '.median()':
        return a.median()
    elif y == '.std()':
        return a.std()
    elif y == '.min()':
        return a.min()
    elif y == '.max()':
        return a.max()
    
for x, y in zip(['mean', 'median', 'standard deviation', 'minimum', 'maximum'], ['.mean()', '.median()', '.std()', '.min()', '.max()']):
    a=df[feature]
    returned=function_arb(a,y)
    print(str("{x2} {feature_2} was $".format(x2=x,feature_2=feature)),float("%.2f" % returned), sep='')
mean P/B Ratio was $-1.72
median P/B Ratio was $-1.07
standard deviation P/B Ratio was $13.97
minimum P/B Ratio was $-76.12
maximum P/B Ratio was $129.06

end of histogram_boxplots¶

def labeled_barplot():¶
In [91]:
# function to create labeled barplots


def labeled_barplot(df, feature, perc=False, n=None, figsize=None):
    """
    Barplot with percentage at the top

    data: dataframe
    feature: dataframe column
    perc: whether to display percentages instead of count (default is False)
    n: displays the top n category levels (default is None, i.e., display all levels)
    """

    total = len(df[feature])  # length of the column
    count = df[feature].nunique()
    if figsize==None:
        if n is None:
            plt.figure(figsize=(count + 1, 5))
        else:
            plt.figure(figsize=(n + 1, 5))
    else:
        plt.figure(figsize=figsize)
    plt.xticks(rotation=90, fontsize=14)
    ax = sns.countplot(
        data=df,
        x=feature,
        palette="Paired",
        order=df[feature].value_counts().index[:n].sort_values(),
    )

    for p in ax.patches:
        if perc == True:
            label = "{:.1f}%".format(
                100 * p.get_height() / total
            )  # percentage of each class of the category
        else:
            label = p.get_height()  # count of each level of the category

        x = p.get_x() + p.get_width() / 2  # width of the plot
        y = p.get_height()  # height of the plot

        ax.annotate(
            label,
            (x, y),
            ha="center",
            va="center",
            size=12,
            xytext=(0, 5),
            textcoords="offset points",
        )  # annotate the percentage

    plt.show()  # show the plot

labeled_barplots¶

GICS Sector¶
In [92]:
labeled_barplot(df, 'GICS Sector', perc=True, figsize=(7,1))

The Industrials Sector had the most companies in the sample of 340 companies.

GICS Sub-Industry Issue: Convert Series to DataFrame and Get output of Index values:¶

Not working / deprecated: unpack(df) How to unpack the columns of a pandas DataFrame to multiple variables

Issue: Works on DataFrame not Series: DataFrame.unstack(level=- 1, fill_value=None) pandas.DataFrame.unstack

Solution: df['GICS Sector'].apply(pd.Series) | out.apply(pd.Series) How to unpack a Series of tuples in Pandas?

In [93]:
type(df['GICS Sector'].value_counts().index)
# how to unpack pandas index
Out[93]:
pandas.core.indexes.base.Index
In [94]:
df['GICS Sector'].apply(pd.Series).head(3)
Out[94]:
0
0 Industrials
1 Health Care
2 Health Care
In [95]:
GICS_Sector_Series_as_df=df['GICS Sector'].apply(pd.Series)

pandas.RangeIndex

In [96]:
GICS_Sector_Series_as_df.keys()
Out[96]:
RangeIndex(start=0, stop=1, step=1)
In [97]:
type(GICS_Sector_Series_as_df)
Out[97]:
pandas.core.frame.DataFrame
In [238]:
GICS_Sector_Series_as_df.keys() # RangeIndex(start=0, stop=1, step=1)
type(GICS_Sector_Series_as_df.keys())
GICS_Sector_Series_as_df.keys()
Out[238]:
RangeIndex(start=0, stop=1, step=1)
In [99]:
print(GICS_Sector_Series_as_df.keys())
RangeIndex(start=0, stop=1, step=1)

unused: Pandas DataFrame RangeIndex

From ChatGPT3: How to see the keys?:

In [100]:
print(GICS_Sector_Series_as_df.columns)
RangeIndex(start=0, stop=1, step=1)
In [101]:
print(GICS_Sector_Series_as_df.columns)
RangeIndex(start=0, stop=1, step=1)
In [102]:
print(GICS_Sector_Series_as_df.keys().tolist())
[0]
In [103]:
GICS_Sector_Series_as_df.head(3)
Out[103]:
0
0 Industrials
1 Health Care
2 Health Care
In [104]:
type(GICS_Sector_Series_as_df[0])
Out[104]:
pandas.core.series.Series
In [105]:
GICS_Sector_Series_as_df.index
Out[105]:
RangeIndex(start=0, stop=340, step=1)
Solution: to GICS Sub-Industry Issue: Convert Series to DataFrame and Get output of Index values:¶
In [106]:
GICS_Sector_Series_as_df.index.tolist()[:8] # 0 to 7 of all 340 index values
Out[106]:
[0, 1, 2, 3, 4, 5, 6, 7]
In [107]:
len(GICS_Sector_Series_as_df.index.tolist()) # length or number of values in this dataframe from Series index is list of 340 values
Out[107]:
340

pandas.DataFrame.sort_values | Documentation | pandas

pandas.DataFrame.sort_values¶

DataFrame.sort_values(

                    by,

                    *,

                    axis=0, 

                    ascending=True, 

                    inplace=False, 

                    kind='quicksort', 

                    na_position='last', 

                    ignore_index=False, 

                    key=None)

Sort by the values along either axis. (axis=0 or 1)


Parameters:¶

by :

 str or list of str

      Name or list of names to sort by.

      - if axis is 0 or ‘index’ then by may contain index levels and/or column labels.

      - if axis is 1 or ‘columns’ then by may contain column levels and/or index labels.


axis :

      {0 or ‘index’, 1 or ‘columns’}, default 0

           Axis to be sorted.

ascending :

           bool or list of bool, default True

                Sort ascending vs. descending. Specify list for multiple sort orders. If this is a list of bools, must match the length of the by.

inplace :

        bool, default False

            If True, perform operation in-place.

kind :

    {‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’}, default ‘quicksort’

        Choice of sorting algorithm. See also numpy.sort() for more information. 

        mergesort and stable are the only stable algorithms. 

        For DataFrames, this option is only applied when sorting on a single column or label.

na_position :

            {‘first’, ‘last’}, default ‘last’

                Puts NaNs at the beginning if first; last puts NaNs at the end.


ignore_index :

            bool, default False

                If True, the resulting axis will be labeled 0, 1, …, n - 1.

na_position :

            {‘first’, ‘last’}, default ‘last’

                Puts NaNs at the beginning if first; last puts NaNs at the end.


ignore_index :

            bool, default False

                If True, the resulting axis will be labeled 0, 1, …, n - 1.

key :

    callable, optional

        Apply the key function to the values before sorting. This is similar to the key argument in the builtin sorted() function, with the notable difference that this key function should be vectorized. It should expect a Series and return a Series with the same shape as the input. It will be applied to each column in by independently.


Returns

    DataFrame or None


        DataFrame with sorted values or None if inplace=True.


See also

    DataFrame.sort_index

        Sort a DataFrame by the index.

    Series.sort_values

        Similar method for a Series.

end of notes on pandas.DataFrame.sort_values:¶

GICS Sub Industry¶
sort inputs to GICS Sub Industry Chart¶
In [108]:
sub_ind_order_counts=df['GICS Sub Industry'].sort_values(inplace=False).value_counts()
In [250]:
sub_ind_order_counts.head(4)
Out[250]:
GICS Sub Industry
Oil & Gas Exploration & Production    16
REITs                                 14
Industrial Conglomerates              14
Internet Software & Services          12
Name: count, dtype: int64
In [110]:
df_GICS=df.copy()
In [111]:
# sub_ind_order_counts=df['GICS Sub Industry'].sort_values(inplace=False).value_counts()

df_GICS_sorted=df_GICS['GICS Sub Industry'].sort_values().value_counts()
In [112]:
df_GICS.sort_values(by=['GICS Sub Industry'],inplace=True)
In [253]:
df_GICS_sorted.head(3)
Out[253]:
GICS Sub Industry
Oil & Gas Exploration & Production    16
REITs                                 14
Industrial Conglomerates              14
Name: count, dtype: int64
In [114]:
type(df_GICS_sorted)
Out[114]:
pandas.core.series.Series

References:

  1. (unused) df to Series How to Convert Pandas DataFrame to a Series
  2. (used) Series to df Series.to_frame(name=_NoDefault.no_default) pandas.Series.to_frame
In [252]:
# Note1: convert pandas Series to DataFrame using above reference 2.

# operates on df_GICS_sorted Series

# which is a sorted copy of df
    # sorted for the purpose of getting a sorted plot when fed into 
        # labeled_barplot plotting function

df_GICS_sorted.to_frame().head(4)
Out[252]:
count
GICS Sub Industry
Oil & Gas Exploration & Production 16
REITs 14
Industrial Conglomerates 14
Internet Software & Services 12
In [241]:
df_GICS_sorted.head(3)
Out[241]:
GICS Sub Industry
Oil & Gas Exploration & Production    16
REITs                                 14
Industrial Conglomerates              14
Name: count, dtype: int64
In [117]:
df_GICS_sorted_to_df=df_GICS_sorted.to_frame()
In [118]:
type(df_GICS_sorted)
Out[118]:
pandas.core.series.Series
In [119]:
type(df_GICS_sorted_to_df)
Out[119]:
pandas.core.frame.DataFrame
end of section for 1st attempt to sort inputs to GICS Sub Industry Chart¶
In [247]:
labeled_barplot(df_GICS_sorted_to_df.sort_values(by=['count']), feature='count', perc=True, figsize=(9,1))
df.sample(1)¶
In [256]:
df.sample(1)
Out[256]:
Ticker Symbol Security GICS Sector GICS Sub Industry Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio
132 FLR Fluor Corp. Industrials Diversified Commercial Services 47.220001 10.819056 1.774454 14 73 -43239000 412512000 2.85 144741052.6 16.568421 14.992623
end of section: df.sample(1)¶
Create df: To order companies from highest to lowest by count of companies in each GICS Sub Industry:¶
  1. create a DataFrame from df which has:
    • count of companies in each GICS Sub Industry
    • order from highest to lowest count
    • plot labeled_barplot of the above
In [255]:
df_3=df.copy()
df_3.head(1) # DataFrame
Out[255]:
Ticker Symbol Security GICS Sector GICS Sub Industry Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio
0 AAL American Airlines Group Industrials Airlines 42.349998 9.999995 1.687151 135 51 -604000000 7610000000 11.39 668129938.5 3.718174 -8.784219

Reference: seaborn.countplot

In [123]:
lookup_table=df_3['GICS Sub Industry'].value_counts()
In [124]:
lookup_table.head(4)
Out[124]:
GICS Sub Industry
Oil & Gas Exploration & Production    16
REITs                                 14
Industrial Conglomerates              14
Electric Utilities                    12
Name: count, dtype: int64
In [125]:
# from def labeled_barplot(df, feature, perc=False, n=None)
# use:
# sns.countplot
# plt.show()
def labeled_barplot_2(df, feature, perc=False, n=None):
    
    total = len(df[feature])  # length of the column
    count = df[feature].nunique()
    if n is None:
        plt.figure(figsize=(count + 1, 5))
    else:
        plt.figure(figsize=(n + 1, 5))

    
    sns.countplot(data=df_3, x='GICS Sub Industry', palette="Paired", order=df_3['GICS Sub Industry'].value_counts().index)
    plt.xticks(rotation=90, fontsize=10)
    ax = sns.countplot(
        data=df,
        x=feature,
        palette="Paired",
        order=df[feature].value_counts().index[:n].sort_values(),
    )
    for p in ax.patches:
        if perc == True:
            label = "{:.1f}%".format(
                100 * p.get_height() / total
            )  # percentage of each class of the category
        else:
            label = p.get_height()  # count of each level of the category

        x = p.get_x() + p.get_width() / 2  # width of the plot
        y = p.get_height()  # height of the plot

    ax.annotate(
        label,
        (x, y),
        ha="center",
        va="center",
        size=12,
        xytext=(0, 5),
        textcoords="offset points",
    )  # annotate the percentage


    plt.show()

want to use labeled_barplot_2() function to plot a barplot, whereby the lookup_table is consulted to get the order of the bars in the barplot [Deprecated]

TabNine and GitHub Copilot assisted in figuring out how to order labeled barplot bars by count of companies in each 'GCIS Sub Industry' Subsector.

In [126]:
df_3['GICS Sub Industry'].value_counts().index[:10].sort_values()
Out[126]:
Index(['Banks', 'Diversified Financial Services', 'Electric Utilities',
       'Health Care Equipment', 'Industrial Conglomerates',
       'Internet Software & Services', 'MultiUtilities',
       'Oil & Gas Exploration & Production', 'Property & Casualty Insurance',
       'REITs'],
      dtype='object', name='GICS Sub Industry')
In [127]:
df_3['GICS Sub Industry']
Out[127]:
0                          Airlines
1                   Pharmaceuticals
2             Health Care Equipment
3              Application Software
4                    Semiconductors
                   ...             
335    Internet Software & Services
336                     Restaurants
337           Health Care Equipment
338                  Regional Banks
339                 Pharmaceuticals
Name: GICS Sub Industry, Length: 340, dtype: object
End of Section: Create df: To order companies from highest to lowest by count of companies in each GICS Sub Industry¶
failed to make descending order labeled_barplot:¶
In [128]:
labeled_barplot(df, 'GICS Sub Industry', perc=True)  ## Complete the code to create a labelled barplot for 'GICS Sub Industry'
end of section: failed to make descending order labeled_barplot:¶
Prep for ChatGPT3 support request:¶
In [129]:
type(sub_ind_order_counts)
Out[129]:
pandas.core.series.Series
end of section: Prep for ChatGPT3 support request:¶
ChatGPT3 attempt 1:¶

Q/ I was wondering om python: how to use sns.countplot on df to plot in descending order based not on a feature directly of the df but on counts of unque value in that feature

A/ You can use the value_counts() method in Pandas to count the number of occurrences of each unique value in the column of interest, and then use that to sort the order of the bars in your Seaborn countplot.

Here's an example of how to do it:

df = pd.DataFrame({
    'fruit': ['apple', 'banana', 'apple', 'orange', 'banana', 'banana', 'kiwi']
})

# Count the number of occurrences of each unique value in the 'fruit' column
fruit_counts = df['fruit'].value_counts()

# Sort the order of the bars in the countplot based on the counts of each unique value
sns.countplot(x='fruit', data=df, order=fruit_counts.index)
ChatGPT3 attempt 2: Text:¶
ChatGPT3 response (adapted):¶

step 0: labeled_barplot will be modified so that it can receive a parameter 'sort_by_count' to change the way the countplot is ordered

  • If sort_by_count is True, then the countplot should be ordered by the descending count of each category. Otherwise, the countplot should be ordered by alphabetical order.

step 2: The modified function labeled_barplot based on sns.countplot is as follows:

ChatGPT3 attempt 2: prep Code for adapted labeled_barplot_6:¶
In [130]:
def labeled_barplot_6(df, feature, perc=False, n=None, sort_by_count=False):
    """
    Barplot with percentage at the top

    data: dataframe
    feature: dataframe column
    perc: whether to display percentages instead of count (default is False)
    n: displays the top n category levels (default is None, i.e., display all levels)
    sort_by_count: whether to sort the categories by count (default is False)
    """

    total = len(df[feature])  # length of the column
    count = df[feature].nunique()
    if n is None:
        plt.figure(figsize=(count + 1, 5))
    else:
        plt.figure(figsize=(n + 1, 5))

    plt.xticks(rotation=90, fontsize=15)
    if sort_by_count:
        ax = sns.countplot(
            data=df,
            x=feature,
            palette="Paired",
            order=df[feature].value_counts().sort_values(ascending=False).index[:n],
        )
    else:
        ax = sns.countplot(
            data=df,
            x=feature,
            palette="Paired",
            order=df[feature].sort_values().unique()[:n],
        )

    for p in ax.patches:
        if perc == True:
            label = "{:.1f}%".format(
                100 * p.get_height() / total
            )  # percentage of each class of the category
end of section: ChatGPT3 attempt 2: Code for adapted labeled_barplot_6.¶
[Solution] ordered Chart with x-axis labeled by GICS Sub Industry:¶
In [131]:
labeled_barplot_6(df, 'GICS Sub Industry', perc=True, n=None, sort_by_count=True)
# where n is the number of sub sectors to display on the countplot
end of section: [Solution] ordered Chart with x-axis labeled by GICS Sub Industry.¶

debug string value error:¶
In [261]:
# df.info()
df["Security"].head(1)
Out[261]:
0    American Airlines Group
Name: Security, dtype: object

end of labeled_barplots¶

Bivariate Analysis¶

In [135]:
df_nameless = df.drop(["Security", "Ticker Symbol"], axis=1)

The following steps are adapted from chatgpt3 (Up to (including) create heat map of the reordered pivot table):

Create a pivot table, with indexes for 2 naming columns Ticker Name and Security.

chatgpt3: use pairplot and scatterplot:

estimated time for sns.pairplot: ~26.1 - 32.8 s

In [136]:
sns.pairplot(df)
Out[136]:
<seaborn.axisgrid.PairGrid at 0x2cda3023070>
  • stackoverflow | nested loop, counters 1 apart
  • Towards DataScience | Quadrant Analysis "A Quadrant chart is ... a scatter plot ... divided into 4 sections / quadrants"

Create a pivot table of the DataFrame, with Name1 and Name2 as index, Category1 and Category2 as columns, and Value as the values:¶

pivot = df.pivot_table(values='Value', index=['Name1', 'Name2'], columns=['Category1', 'Category2'], fill_value=0)
In [138]:
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 340 entries, 0 to 339
Data columns (total 15 columns):
 #   Column                        Non-Null Count  Dtype  
---  ------                        --------------  -----  
 0   Ticker Symbol                 340 non-null    object 
 1   Security                      340 non-null    object 
 2   GICS Sector                   340 non-null    object 
 3   GICS Sub Industry             340 non-null    object 
 4   Current Price                 340 non-null    float64
 5   Price Change                  340 non-null    float64
 6   Volatility                    340 non-null    float64
 7   ROE                           340 non-null    int64  
 8   Cash Ratio                    340 non-null    int64  
 9   Net Cash Flow                 340 non-null    int64  
 10  Net Income                    340 non-null    int64  
 11  Earnings Per Share            340 non-null    float64
 12  Estimated Shares Outstanding  340 non-null    float64
 13  P/E Ratio                     340 non-null    float64
 14  P/B Ratio                     340 non-null    float64
dtypes: float64(7), int64(4), object(4)
memory usage: 40.0+ KB

sel_cols = [c for c in df.columns if df[c].dtype in ['object', 'datetime64[ns]']] sparkbyexample | select columns by type

In [139]:
# list comprehensions per chatgpt3
idx_cols=[c for c in df.columns if df[c].dtype in ['object']] # GitHub Copilot
valu_cols=[c for c in df.columns if df[c].dtype in ['float64', 'int64']] # GitHub Copilot, Tabnine AI
In [140]:
pivot = df.pivot_table(values=valu_cols, index=idx_cols, aggfunc='mean') # GitHub Copilot, Tabnine AI

Compute the pairwise distances between the rows of the pivot table:¶

row_dist = pd.DataFrame(squareform(pdist(pivot, metric='euclidean')), columns=pivot.index, index=pivot.index)
In [141]:
# NameError: name 'squareform' is not defined # ChatgGPT3
# from scipy.spatial.distance import pdist, squareform
row_dist=pd.DataFrame(squareform(pdist(pivot, metric='euclidean')), columns=pivot.index, index=pivot.index) # GitHub Copilot, Tabnine AI, ChatGPT3

Compute the linkage matrix using the distances:¶

row_clusters = linkage(row_dist, method='complete')
In [142]:
row_clusters = linkage(row_dist, method='complete')

Create the dendrogram of the clusters:

fig = plt.figure(figsize=(8,8))
axd = fig.add_axes([0.09,0.1,0.2,0.6])
row_dendr = dendrogram(row_clusters, orientation='left')
In [143]:
fig = plt.figure(figsize=(8,8))
axd = fig.add_axes([0.09,0.1,0.2,0.6])
row_dendr = dendrogram(row_clusters, orientation='left')

Reorder the pivot table according to the clustering:¶

df_rowclust = pivot.iloc[row_dendr['leaves']]
In [144]:
df_rowclust = pivot.iloc[row_dendr['leaves']]

Create the heatmap of the reordered pivot table:¶

sns.heatmap(df_rowclust, cmap='RdBu_r')
In [233]:
plt.figure(figsize=(9, 5))
sns.heatmap(
    df_rowclust.corr(), annot=True, vmin=-1, vmax=1, fmt=".2f", cmap="Spectral"
)
plt.show()

Positive Correlations:¶

From the above analysis, in which a heatmap was created from a dataframe which was created from reordering Ticker Name, Security, GICS Sector, and GICS Sub Industry: (GitHub Copilot assisted.)

Estimated Shares Outstanding and P/E Ratio are not highly correlated. (although GitHub Copilot suggested they would be.)

("Highly" is used relatiely here, as the correlations are not extremely high for any variable pair.)

Net Income is highly correlated to Earnings Per Share, and Estimated Shares Outstanding. (56%, 59%, respectively)

Earnings per share is also highly correlated to Current Price. (48%)


Negative Correlations:¶

Puzzlingly, from this heatmap: if you get good Earnings per Share you would expect a poor Return on Equity (ROE) ( -41%).

  • One way to explain this maybe that if the particular stock you are analyzing is a high growth stock, then you would expect a low ROE, as the company is reinvesting its profits into growth. (This is a common strategy for high growth companies, as they are trying to grow their business as fast as possible, and they are not interested in paying dividends to shareholders, as they are trying to reinvest their profits into growth.) (From GitHub Copilot.)
  • Another explanation might be that the company is not profitable, and is not paying dividends to shareholders, and is reinvesting its profits into growth. (From GitHub Copilot.)
  • A third explanation might be that the company is not profitable, and is paying dividends to shareholders, and is reinvesting its profits into growth. (From GitHub Copilot.)
  • A fourth explanation might be that the company is profitable, and is paying dividends to shareholders, and is reinvesting its profits into growth. (From GitHub Copilot.)
  • A fifth explanation might be that the company is profitable, and is not paying dividends to shareholders, and is reinvesting its profits into growth. (From GitHub Copilot.)
  • Case 6: The company is profitable, and is paying dividends to shareholders, and is not reinvesting its profits into growth. (From GitHub Copilot.)
  • Case 7: The company is profitable, and is not paying dividends to shareholders, and is not reinvesting its profits into growth. (From GitHub Copilot.) To put these previous 4 points into a 2 x 2 matrix with the 2 axes being: "Is the company profitable?" and "Is the company reinvesting its profits into growth?", we get the following matrix:
    | case | profitable | reinvesting profits into growth | paying dividend | case | issue |
    | ---- | ---------- | ------------------------------- | --------------- | ---- | ----- |
    | 1 | yes | yes | y/n | 1 | N/A |
    | 2 | no | yes | no | 2 | no profits to reinvest in growth |
    | 3 | no | yes | yes | 3 | don't dividends get paid out of profits? (Also reinvesting (no) profits) |
    | 4 | yes | | | 4 | |
    The above matrix can be used to explain the negative correlation between ROE and Earnings per Share. (From GitHub Copilot.)

note: Excel file heatmap_insights_anaysis.xlsx must be open for load() from xlwings library to run

Read in data from Excel:¶

In [148]:
# loads from excel using xlwings
# load()
In [149]:
pd.read_excel('../data/heatmap_insights_analysis.xlsx')
Out[149]:
case profitable reinvesting profits into growth paying dividend case.1 issue
0 1 y y y/n 1 NaN
1 2 n y n 2 no profits to reinvest in growth
2 3 n y y 3 don't dividends get paid out of profits? (Also...
3 4 y y y 4 NaN
4 5 y y n 5 NaN
5 6 y n y 6 NaN
6 7 y n n 7 NaN
7 8 NaN NaN NaN 8 NaN

Further reasoning on negative correlation explanation:¶

Possibly, gains are already priced into stocks with good Earnings per Share,

so that the stock price has already peaked, reducing likelihood of Return on Equity in this case of high Earnings per Share. (This line with support from GitHub Copilot.)

(If a company had good profits (Earnings) (last quarter) and low stock price (GH Copilot), Earnings per Share is high (high EPS).)

However, as the quarter progresses there may be an unknown deviation of actual from expected earnings per share,

which only becomes apparent to the market when Earnings are reported

so that EPS and Stock Price are likely to change as soon as Earnings come in (earnings season).

Earnings Season:¶

When is earnings Season 2023 US? Investopedia | Earnings Season

Earnings season 
typically begin 
in the month following 
most major companies' fiscal quarters:

January, April, July, and October.

It generally lasts about 6 weeks, 
at which point the number of earnings reports being released 
return to non-earnings season levels.

Explaining Return on Equity negative correlation with Earnings per share (-41% correlation from heatmap) (continued):¶

To return to the subject of trying to explain the inverse correlation between ROE and EPS, GitHub Copilot suggested that this was a function of reinvestment of profits and paying a dividend. However, since both of these would appear to be dependent on being profitable, more certainly over an extended period of time, some of the answers given seem to be contradictory.

One explanation that seems to make sense is that as soon as a company publishes earnings (profits), these are factored into the price, and therefore earnings per share is no longer a good indicator of future price, but instead is a lagging indicator (rather than a leading indicator).

Lagging indicators:¶

According to geckoboard.com:

Lagging indicators take a long time to change, and show the later-stage results of your efforts. Leading indicators, on the other hand, measure the activities you think will help you reach your goal, and can be tracked on a more ongoing basis.
  • Leading / Lagging Indicators | geckoboard.com

However, we will try for another explanation of leading and lagging indicator.


Leading, Lagging and Coincident Indicators:¶

  • TRADING > TRADING STRATEGIES > Leading, Lagging, and Coincident Indicators | investopedia.com

Economists and investors are constantly watching for:

  • signs of what's immediately ahead for the markets and
    • for the larger economy.

The most closely watched of these signs are:

  • economic or business statistics that are
    • tracked from month to month and
      • therefore indicate a pattern.

All indicators fall into 1 of 3 categories:

  1. Leading indicators are considered to point toward future events.
  2. Lagging indicators are seen as confirming a pattern that is in progress.
  3. Coincident indicators occur in real-time and clarify the state of the economy.
  • TRADING > TRADING STRATEGIES > Leading, Lagging, and Coincident Indicators | investopedia.com

Proposed Consideration of Earnings per Share as a Lagging indicator:¶

From the above definition of Lagging indicators from investopedia.com, the EPS (Earnings per Share) would seem to indicate a pattern that is retrospective and hence a lagging indicator.

The company carries out business operations:

  • These operations in the given wider business environment result in a bottom line indicating profit/loss
  • These profits are then reported, usually during earnings season (1st month of each quarter).
  • Until profits (earnings) are published the market prices the stock based upon expectation.
  • Immediately upon publication the stock price adjusts from pricing based upon expected or forecast earnings to actual published earnings, in a step function change approximated by the heaviside function. (- This does not account for those stakeholders and personnell in close dealings with the company, (including suppliers, wholesalers, consumers, investors, etc.) who may have greater knowledge of business operations.
    • This sets up a mechanism which may provide information to the market in the form of price, as entities will act in the market according to the information available to them.
      • For this reason, the share price could be thought of as a composite of a lagging indicator (due to earnings only being published quarterly) and a coincident indicator (not because at those moments early in the fiscal quarter when the earnings are published, the price adjustment is basically momentarily coincident with the economic condition (although it could be argued that since these (quarterly earnings reports (10-Q e.g. APPL 10-Q for Q1 2023)) are compiled retrospectively on last quarter performance they are retrospective albeit slightly-closer
        • to-being-contemporaneous-than-normal, as lagging indicators, briefly at that moment when they are published.)) )

Apple 10-K Report Excerpt on Competition:¶

(A summary of key performance indicators and information on the business are published in the 10-K Yearly Shareholder report, publicly available on SEC.gov for all publicly traded companies in the United States.)

For example, here is an adapted excerpt (on Competition) from the APPL 2022 10-K Report, which distills the factors which characterize the market environment in which business operations take place:


The markets for the Company’s products and services are

- highly competitive, and

- are characterized by:

    1. aggressive price competition
        (- and resulting downward pressure on:
            - gross margins),
    2. frequent introduction of new products and services,
    3. short product life cycles,
    4. evolving industry standards,
    5. continual improvement in product price and performance characteristics,
    6. rapid adoption of technological advancements by competitors, and
    7. price sensitivity on the part of consumers and businesses.

Proposed consideration of price as composed of two factors: concurrent and lagging indicators:¶

(Side note: An argument (not discussed here) could also be made that price has an element of speculation built in, whether this is a leading indicator is another debate.)

In summary of thoughts to date: there are 2 mechanisms at work:

  • one which contributes to that practically unknown fraction of the price being broadly a concurrent indicator
    • influenced by live information about the company, and the interaction with the business environment and the wider market.
  • a second which contributes to that practically unkown fraction of the price being broadly a lagging indicator
    • influenced by quarterly reports
      • which are themselves retrospective
        • due to relying on:
          • last quarter's earnings,
          • as well as:
            • due to the fact that information in these reports is quickly incorporated into price as soon as published,
            • and immediately after the instant of publication:
              • - these reports are no longer relevant to trying to predict future share price.

Primary Conclusion on Earnings Per Share inverse relationship to Return on Equity:¶

Therefore, primarily, Earnings Per Share (EPS) is not a leading indicator, and therefore cannot be used as a predictor for future Return on Equity (ROE).

Secondary Conclusion on Earnings Per Share inverse relationship to Return on Equity:¶

Secondarily, due to the pursuit of the "buy low, sell high" ideal by retail traders

  • and the involvement of human emotion in trading,
    • exacerbated by the nature of short and long term debt cycles, contributing to boom and bust and hype:
  • these factors often take over from the logic of investing 60 / 40 stocks and bonds split or simply investing in the Standard & Poor's 500 or other indices.

Continuing Stocks / Bonds 60/40 split:¶

Alternative views on stock / bond split ratios:¶

  • recent conditions have led to newly proposed: Bonds Over Stocks: The New 60-40 Portfolio

  • Why a 60/40 Portfolio Is No Longer Good Enough | investopedia.com

A series of bear markets that started in 2000 coupled with historically low-interest rates have eroded the popularity of [portfolios made by financial planners and stockbrokers for their clients composed of 60% equities and 40% bonds].

Discussion on stock / bond split ratios:¶

  • The 'Investment Committee' weigh in on the traditional 60/40 portfolio

Continuing discussion on negative correlation between Earnings per Share and Return on Equity (-41%):¶

To summarize thoughts on negative correlation between EPS and ROE:

  • as Earnings are already priced into the Share Price:
  • and given the aim to buy low and sell high
  • with the risk (exacerbated by hype)
    • of only hearing about a recent trend when towards the end of a cycle
      • ironically, when early buyers are looking to liquify their position
    • may lead to a situation in which the retail trader earnestly seeking to buy low, sell high,
      • may in fact buy just after the peak, thinking that after a recent fall in price, the price is about to take off again, when in fact the price has hit a support level (1)
    • the ratio if the Earnings Per Share

Of note:

not everyone 'buys into' technical analysis (2)

Technical analysis may be contrasted with fundamental analysis, which focuses on a company's financials rather than historical price patterns or stock trends.

Some opt for fundamental analysis

  • which measures a security's intrinsic value by examining related economic and financial factors.
  • where the end goal is to determine a number that an investor can compare with a security's current price to see whether the security is
    • undervalued or
    • overvalued
  • by other investors. (3)

(1) TECHNICAL ANALYSIS > TECHNICAL ANALYSIS BASIC EDUCATION > Support and Resistance Basics | Investopedia

(2) technical analysis | Investopedia

(3) fundamental analysis | Investopedia

Further reference on Technical Analysis:¶

  • Charting the Market: S&P 500 Key Levels to Watch

Continuining on both the themes of:

  • EPS negatively correlated to ROE and
  • fundamental analysis
    • to:
      determine a number that an investor can compare with a security's current price to see whether the security is
        -  `undervalued or`<br>
        - `overvalued` (1)

(1) fundamental analysis | Investopedia

...

If instead of buying low and selling high retail traders are more likely to buy high and sell low (particularly in the tract of market history analysed here), then it may indicate that either a good analysis or understanding of the fundamentals is not occurring or that despite best efforts emotion is taking over causing mass buying of overheated hyped stock bubbles under the mistaken forecast, say, that upward trends will continue as they are about to burst.

This would in effect lead to the inverted:

buy high sell low.

If this is in fact what is occurring over this period,

this would be reflected in high earning per share companies

with good quarterly and yearly reports and businesses

in all or certain areas of the market which may be overheated

being overbought,

so that they have already been overbought,

leading to fewer shares outstanding,

creating upward price pressure, due to Keynsian scarcety of supply of the stock,

crashing through resistance bands being supported by the rising tide of buyers watching the price rise and trying to get in on the bull run,

only to be stopped out

of trades when the bubble bursts and buyers loose interest,

leading to

high earnings per share stocks being overbought initally (at high prices) during the up trend,

only to be then oversold in the subsequent correction (possible overcorrection),

(depending on what the coefficient of damping for the economic system being modelled is)

and whether there is over and undershoot or not of the theoretical real price of the stock.

  • This leads to a negative correlation between Earnings per Share and Return on Equity, with a correlation of -40% for the feature pair in the dataset.

Side note on Examples of Alternative pressures on stock price:¶

relative performance to competitor performance¶

  • Ford Motor Co. stock falls Wednesday, underperforms market | MarketWatch
The stock underperformed when compared to some of its competitors Wednesday, as Tesla Inc. TSLA, -7.77% fell 2.02% to $180.59.

Trading volume (68.9 M) eclipsed its 50-day average volume of 68.5 M.

(1)

(1) Ford Motor Co. stock falls Wednesday, underperforms market | MarketWatch

Further note on Ford Motor Company¶

[April 20, 2023 10:45 AM]

  • Monday marks the last chance for investors to receive the next dividend payout from Ford Motor

  • The company announced on Thursday that it would pay shareholders a quarterly dividend of 15 cents per share. On Tuesday, Ford Motor will go ex-dividend, meaning the stock will trade lower to reflect that payout. In other words, the stock will likely open 15 cents lower than it would have opened on any other day.

  • Ford Motor: Dividend Insights

Price-to-Book Ratio (PB) or (P/B):¶

  • Price-to-Book (PB) Ratio: Meadning, Formula, and Example

  • measures the market's valuation of a company relative to its book value.

  • to compare a firm's market capitalization to its book value and locate undervalued companies

  • ratio is calculated by dividing the company's current stock price per share by its book value per share (BVPS)

  • P/B Ratio= Book Value per Share (BVPS) / Market Price per Share

    • where,
      • Market Price per Share = Current market price of the share
      • Book Value per Share = (Total assets - intangible assets - total liabilities) ÷ number of outstanding shares

(1)

(1) Price-to-Book (PB) Ratio: Meadning, Formula, and Example

intangible assets:¶

  • The following is an adapted excerpt from What Are Intangible Assets? Examples and How to Value:

  • Goodwill, brand recognition and intellectual property, such as patents, trademarks, and copyrights, are all intangible assets.

  • Intangible assets exist in opposition to tangible assets,

    • which include:
      • land,
      • vehicles,
      • equipment, and
      • inventory.
  • Additionally, financial assets such as:

    • stocks and
    • bonds,
      • which derive their value from:
        • contractual claims, -are considered tangible assets.

(1)

(1) What Are Intangible Assets? Examples and How to Value

end of Further note on negative correlation¶

Next steps in Bivariate Analysis:¶

Let's check the stocks of which economic sector have seen the maximum price increase on average.

In [235]:
plt.figure(figsize=(6, 1.5))
sns.barplot(data=df, x='GICS Sector', y='Price Change', ci=False) ## Complete the code to choose the right variables
plt.xticks(rotation=90)
plt.show()
Upon inspection of the above barplot:¶
  • Over the period of this analysis, the Energy Sector experienced a negative Price Change.
  • All other industrial sectors had positive price changes over the period.
Cash ratio provides a measure of a company's ability to cover its short-term obligations using only cash and cash equivalents. Let's see how the average cash ratio varies across economic sectors.¶
In [236]:
plt.figure(figsize=(5,1.2))
sns.barplot(data=df, x='GICS Sector', y='Cash Ratio', ci=False)  ## Complete the code to choose the right variables
plt.xticks(rotation=90)
plt.show()
From the above barplot of GICS Sector versus Cash Ratio (for the 11 GICS Sectors shown on the X-axis):¶
  • The highest Cash Ratio was in Information Technology (at approximately 150).
  • The next highest Cash Ratio was in Telecommunications Service (at just below 120).
  • The third highest Cash Ratio was in Health Care (at just above 100).
  • The fourth highest Cash Ratio was in Financials (at just below 100).
  • The fifth highest Cash Ratio (significantly lower) was Consumer Staples (at approximately 70).
  • In contrast, (a few ranks below those mentioned above, thus breaking the sequence) Consumer Discretionary Cash Ratio was around 50, on par with Energy and Real Estate for Ranks 6, 7 and 8.
  • Ranks 9, 10 and 11 are: Matrials, Industrials and Utilities to round out the Cash Ratio Rankings per GICS Sector.

Financial Terminology¶

Cash Ratio¶
  • a measurement of a company's liquidity.
  • It specifically calculates the ratio of a company's:
    • total cash and cash equivalents to its
    • current liabilities.
  • The metric evaluates company's ability to repay its short-term debt
    • with cash or near-cash resources,
      • such as easily marketable securities.

Cash Ratio | Investopedia


Marketable Securities¶
  • liquid financial instruments that can be quickly converted into cash at a reasonable price. CORPORATE FINANCE > ACCOUNTING > Marketable Securities | Investopedia

Financial instruments¶

assets that can be traded, or they can also be seen as packages of capital that may be traded.

  • Most types of financial instruments provide efficient flow and transfer of capital all throughout the world’s investors.
  • These assets can be in the form of:
    • cash,
      • a contractual right to deliver or receive cash or
        • another type of financial instrument, or
    • evidence of one’s ownership in some entity. INVESTING > INVESTING BASICS > Financial Instruments | Investopedia

Capital¶
Capital: Definition, How It's Used, Structure, and Types in Business¶

Capital is a broad term that can describe anything that:

  • confers value or benefit to its owners,
    • such as a factory and its
      • machinery,
      • intellectual property like:
        • patents, or the
        • financial assets:
          • of a business or an
          • individual.

While money itself may be construed as capital,

  • capital is more often associated with:
    • cash
      • that is being put to work for:
        • productive or
        • investment purposes. In general,
  • capital is a critical component of running a business
    • from day to day and
    • financing its future growth.

ECONOMY > ECONOMICS > Capital


Investor¶

What Does an Investor Do? What Are the Different Types? [Updated February 17, 2023]¶

An investor is any person or other entity (such as a firm or mutual fund)

  • who commits capital with the expectation of receiving financial returns.

Investors rely on different financial instruments

  • to earn a rate of return and accomplish important financial objectives like:
    • building retirement savings,
    • funding a college education, or merely
    • accumulating additional wealth over time. TRADING SKILLS > TRADING BASIC EDUCATION > Investor

Financial Assets¶

Financial Asset Definition and Liquid vs. Illiquid Types¶

A financial asset is a:

  • liquid asset

    • that gets its value from a:
      • contractual right or
      • ownership claim.
    • Cash,
    • stocks,
    • bonds,
    • mutual funds, and
    • bank deposits are all are examples of financial assets.

      Unlike:

    • land,
    • property,
    • commodities, or other
    • tangible physical assets,

      financial assets do not necessarily have inherent:

    • physical worth or even a
    • physical form.

      Rather, their value reflects factors of supply and demand

    • in the marketplace in which they trade,
    • as well as the degree of risk they carry.

CORPORATE FINANCE > ACCOUNTING > Financial Assets


Asset¶

What Is an Asset? Definition, Types, and Examples [Updated March 29, 2023]¶

An asset is a

  • resource with economic value that an:
    • individual,
    • corporation, or
    • country
  • owns or controls with the
  • expectation that it will provide a future benefit. CORPORATE FINANCE > FINANCIAL STATEMENTS > Asset

End of Financial Terminology Section¶



P/E Ratio versus GICS Sector barplot¶

P/E ratios can help determine the relative value of a company's shares as they signify the amount of money an investor is willing to invest in a single share of a company per dollar of its earnings. Let's see how the P/E ratio varies, on average, across economic sectors.

In [152]:
plt.figure(figsize=(5,1))
sns.barplot(data=df, x='GICS Sector', y='P/E Ratio', ci=False)  ## Complete the code to choose the right variables
plt.xticks(rotation=90)
plt.show()
From the above barplot:¶
  • Energy had the highest P/E Ratio at over 70.
  • The next highest 3 sectors were close in P/E Ratio (just above 40, and barely over half that of Energy ):
    • They were Information Technology (2nd), followed by
    • Real Estate (3rd), and
    • Health Care (4th)
  • The 5th highest was Consumer Discretionary at around 35.
  • The 6th highest was Consumer Staples at around 25.
  • The 7th highest was Materials also around 25.
  • The next 2 sectors came in at just under 20 for P/E Ratio:
    • They were Industrials, and
    • Utilities
  • The 10th highest was Financials at just over 15
  • The 11th highest was Telecommunications Services at just over 10.

End of P/E Ratio versus GICS Section barplot¶


Business definitions and theory¶

P/E Ratio | INVESTING FUNDAMENTAL ANALYSIS

P/E Ratio - Price-to-Earnings Ratio Formula, Meaning, and Examples:¶
  • The price-to-earnings ratio is the ratio for valuing a company that measures its current share price relative to its earnings per share (EPS).

  • The price-to-earnings ratio is also sometimes known as the:

    • price multiple or the
    • earnings multiple.
  • P/E ratios are used by:

    • investors and
    • analysts
  • to determine the relative value of a company's shares
  • in an apples-to-apples comparison.

  • It can also be used to compare:

    • a company against its
    • own historical record or to
  • compare:
    • aggregate markets against:
      • one another or
      • over time.

P/E may be estimated on a:

  • trailing (backward-looking) or
  • forward (projected) basis.

potentially:

  • high P/E: stock overvalued, or investors expecting high future growth rates.

Companies that have no earnings or that are losing money do not have a P/E ratio because there is nothing to put in the denominator.

Two kinds of P/E ratios—forward and trailing P/E—are used in practice.

A P/E ratio holds:

  • the most value to an analyst
  • when compared against:

    • similar companies in the
    • same industry

      or

    • for a single company across a
    • period of time.

P/E Ratio= Earnings per share / Market value per share ​

To determine the P/E value, one must simply divide the current stock price by the earnings per share (EPS), that is:

P/E ratio = current stock price / earnings per share (EPS)

The current stock price (P) can be found simply by plugging a stock’s ticker symbol into any finance website, and although this concrete value reflects what investors must currently pay for a stock, the EPS is a slightly more nebulous figure.

EPS comes in two main varieties. TTM is a Wall Street acronym for "trailing 12 months". This number signals the company's performance over the past 12 months. The second type of EPS is found in a company's earnings release, which often provides EPS guidance. This is the company's best-educated guess of what it expects to earn in the future. These different versions of EPS form the basis of trailing and forward P/E, respectively.

The P/E ratio helps one determine whether a stock is overvalued or undervalued. A company's P/E can also be benchmarked against other stocks in the same industry or against the broader market, such as the S&P 500 Index.

Sometimes, analysts are interested in long-term valuation trends and consider the P/E 10 or P/E 30 measures, which average the past 10 or past 30 years of earnings, respectively. These measures are often used when trying to gauge the overall value of a stock index, such as the S&P 500, because these longer-term measures can compensate for changes in the business cycle.

The P/E ratio of the S&P 500 has fluctuated from a low of around 5x (in 1917) to over 120x (in 2009 right before the financial crisis). The long-term average P/E for the S&P 500 is around 16x, meaning that the stocks that make up the index collectively command a premium 16 times greater than their weighted average earnings.

P/E for appraising projected EPS:¶

Analysts and investors review a company's P/E ratio when they determine if the share price accurately represents the projected earnings per share.

Some investors prefer to look at the trailing P/E because they don't trust another individual’s earnings estimates. But the trailing P/E also has its share of shortcomings—namely, that a company’s past performance doesn’t signal future behavior.

Investors should thus commit money based on future earnings power, not the past.

P/E Ratio | INVESTING FUNDAMENTAL ANALYSIS


Earnings Power¶

Earnings power is a figure that telegraphs a business's

  • ability to generate profits over the long haul,
    • assuming all current operational conditions generally remain constant. Equity analysts ritually assess a company’s earning power when issuing buy and sell recommendations
  • to best determine if a company’s stock is worth investing in.
Understanding Earnings Power:¶

Earnings power factors in several elements, including a company’s:

  • total assets, plus
  • recent growth or loss trends.

Earning power likewise considers metrics such as a company's:

  • return on assets (ROA),
    • which is the ability to generate profit from its assets, as well as the
  • return on equity (ROE),
    • which is a measurement of a stock’s financial performance.

Furthermore, some companies determine earnings power based on:

  • dividend yields
    • associated with specific securities.
Earnings Power Metrics for Determining Current Business Health¶

A company can cultivate a keen insight into its earnings power by examining earnings before interest and tax (EBIT).

  • This calculation examines a company’s earnings power based on:
    • continuous operations, as well as
    • cash flow.

By generally excluding any and all irregular income or expenses,

  • EBIT provides a reliable snapshot
    • of a company’s liquidity profile,its ability to
    • meet debt obligations, and its
    • overall health.

(1)

(1) CORPORATE FINANCE > CORPORATE FINANCE BASICS > Earnings Power | Investopedia


Earnings Before Interest and Taxes (EBIT)¶

The following excerpt is adapted from CORPORATE FINANCE > FINANCIAL STATEMENTS > Earnings Before Interest and Taxes (EBIT) | Investopedia

Earnings Before Interest and Taxes (EBIT): How to Calculate with Example:¶
What Is Earnings Before Interest and Taxes (EBIT)?:¶

Earnings before interest and taxes (EBIT) is an indicator of a company's profitability.

EBIT can be calculated as revenue minus expenses excluding tax and interest.

EBIT is also referred to as:

  • operating earnings,
  • operating profit, and
  • profit before interest and taxes.

CORPORATE FINANCE > FINANCIAL STATEMENTS > Earnings Before Interest and Taxes (EBIT) | Investopedia


Revenue¶

What is Revenue? Definition, Formula, Calculation, and Example:¶

Revenue is the money generated from normal business operations, calculated as the average sales price times the number of units sold.

Revenue = (average sales price) * (number of units sold)

top line (or gross income) figure from which costs are subtracted to determine net income.

Revenue is also known as sales on the income statement.

CORPORATE FINANCE > FINANCIAL STATEMENTS > Revenue | Investopedia


Income Statement¶

Income Statement: How to Read and Use It [Updated March 27, 2023]¶

What you need to know about this essential financial statement¶
What Is an Income Statement?¶
  1. An income statement is 1 of the 3 important financial statements used for reporting a company’s financial performance over a specific accounting period.

The other two key statements are:

  1. the balance sheet and

  2. the cash flow statement.

CORPORATE FINANCE > FINANCIAL STATEMENTS > Income Statement


Financial Statements¶

The following excerpt is adapted from: CORPORATE FINANCE > FINANCIAL STATEMENTS > Financial Statements | Investopedia

Financial Statements: List of Types and How to Read Them [Updated March 21, 2023]¶

What Are Financial Statements?¶

Financial statements convey business activities and financial performance of a company.

Financial statements are often audited to ensure accuracy.

Primary financial statements include:

  • the balance sheet,
  • income statement,
  • statement of cash flow, and
  • statement of changes in equity.

  • balance sheet: provides an overview of assets, liabilities, and shareholders' equity as a snapshot in time.

  • income statement: primarily focuses on a company’s revenues and expenses during a particular period. Once expenses are subtracted from revenues, the statement produces a company's profit figure called net income.
  • cash flow statement (CFS): measures how well a company generates cash to pay its debt obligations, fund its operating expenses, and fund investments.
  • statement of changes in equity: records how profits are retained within a company for future growth / distributed to external parties.

Investors and financial analysts rely on financial data to analyze the performance of a company and

  • make predictions about the future direction of the company's stock price.

One of the most important resources of reliable and audited financial data is the annual report, which contains the firm's financial statements.

The 3 major financial statement reports are:

  1. the balance sheet,
  2. income statement, and
  3. statement of cash flows.
Balance Sheet:¶

The balance sheet

  • provides an overview of a company's:
    • assets,
    • liabilities, and
    • shareholders' equity

The date at the top of the balance sheet tells you:

  • when the snapshot was taken,
    • which is generally: the end of the reporting period.

Below is a breakdown of the items in a balance sheet.

Assets¶
  • Cash and cash equivalents are: liquid assets, including Treasury bills and certificates of deposit.
  • Accounts receivables are money owed to the company by its customers for the sale of its product and service.
  • Inventory is the goods on hand, intended for sale as a course of business. May include finished goods, work in progress, or raw materials on hand to be worked.
  • Prepaid expenses are costs prepaid in advance of when they are due. Recorded as an asset because their value has not yet been recognized; should the benefit not be recognized, the company would theoretically be due a refund.
  • Property, plant, and equipment are capital assets owned by a company for its long-term benefit. Includes buildings used for manufacturing or heavy machinery used for processing raw materials.
  • Investments are assets held for speculative future growth. These aren't used in operations; they are simply held for capital appreciation.

Trademarks, patents, goodwill, and other intangible assets can't physically be touched but have future economic (and often long-term benefits) for the company.

Liabilities¶
  • Accounts payable are the bills due as part of the normal course of operations of a business. This includes: utility bills, rent invoices, and obligations to buy raw materials.
  • Wages payable are payments due to staff for time worked.
  • Notes payable are recorded debt instruments that record official debt agreements including the payment schedule and amount.
  • Dividends payable are dividends that have been declared to be awarded to shareholders but have not yet been paid.
  • Long-term debt can include a variety of obligations including sinking bond funds, mortgages, or other loans that are due in their entirety in longer than one year. Note that the short-term portion of this debt is recorded as a current liability.
Shareholders' Equity¶

Shareholders' equity is a company's total assets minus its total liabilities. Shareholders' equity (also known as stockholders' equity) represents the amount of money that would be returned to shareholders if all of the assets were liquidated and all of the company's debt was paid off. Retained earnings are part of shareholders' equity and are the amount of net earnings that were not paid to shareholders as dividends.

Example of a Balance Sheet¶

Below is a portion of ExxonMobil Corporation's (XOM) balance sheet for fiscal year 2021, reported as of Dec. 31, 2021.

Total assets: $338.9 billion.

Total liabilities: $163.2 billion.

Total equity: $175.7 billion.

Total liabilities + equity = $338.9 billion = total assets for the period.

Investor Relations | Earnings Call | Exxonmobil

see next cell for xlwings library method load() from excel sheet with same Balance sheet referenced in (1) but taken from (2) for ease of formatting (2)

(1)

(1) CORPORATE FINANCE > FINANCIAL STATEMENTS > Financial Statements | Investopedia

(2) 2021, UNITED STATES, SECURITIES AND EXCHANGE COMMISSION, WASHINGTON, D.C. 20549 | FORM 10-K ☑ ANNUAL REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 | For the fiscal year ended December 31, 2021 | Exxon Mobil Corporation (see page 72 for Balance Sheet on December 31, 2021)


Exxon 2021 Balance Sheet Example¶
  • Try reading DataFrame in using pandas.
  • Debug pandas pd.read_excel() method.
  • Issue: 15 Columns
  • Resave to Local as was saved to OneDrive
  • Rerun pd.read_excel()

Note: from earlier: these values are in millions of USD.

  • Excel: Cut top row in Sheet1, Save
  • Rerun:
    • Exxon2021=pd.read_excel('../data/Balance-Sheet-Exxon-Mobil-2021.xlsx')
    • Exxon2021
  • Issue Fixed [Resolved]
In [153]:
# rerun pd.read_excel() and save to variable
Exxon2021=pd.read_excel('../data/Balance-Sheet-Exxon-Mobil-2021.xlsx')
In [154]:
Exxon2021
Out[154]:
Elements Reference December 31, 2021 December 31, 2020
0 Assets NaN NaN NaN
1 Current assets NaN NaN NaN
2 Cash and cash equivalents NaN 6,802 4,364
3 Notes and accounts receivable - net 6.0 32,383 20,581
4 Inventories NaN NaN NaN
5 Crude oil, products and merchandise 3.0 14,519 14,169
6 Materials and supplies NaN 4,261 4,681
7 Other current assets NaN 1,189 1,098
8 Total current assets NaN 59,154 44,893
9 Investments, advances and long-term receivables 8.0 45,195 43,515
10 Property, plant and equipment, at cost, less a... 9.0 216,552 227,553
11 Other assets, including intangibles - net NaN 18,022 16,789
12 Total assets NaN 338,923 332,750
13 NaN NaN NaN NaN
14 Liabilities NaN NaN NaN
15 Current liabilities NaN NaN NaN
16 Notes and loans payable 6.0 4,276 20,458
17 Accounts payable and accrued liabilities 6.0 50,766 35,221
18 Income taxes payable NaN 1,601 684
19 Total current liabilities NaN 56,643 56,363
20 Long-term debt 14.0 43,428 47,182
21 Postretirement benefits reserves 17.0 18,430 22,415
22 Deferred income tax liabilities 19.0 20,165 18,165
23 Long-term obligations to equity companies NaN 2,857 3,253
24 Other long-term obligations NaN 21,717 21,242
25 Total liabilities NaN 163,240 168,620
26 NaN NaN NaN NaN
27 Commitments and contingencies 16.0 NaN NaN
28 NaN NaN NaN NaN
29 Equity NaN NaN NaN
30 Common stock without par value NaN 15,746 15,688
31 (9,000 million shares authorized, 8,019 millio... NaN NaN NaN
32 Earnings reinvested NaN 392,059 383,943
33 Accumulated other comprehensive income NaN -13764 -16705
34 Common stock held in treasury NaN -225464 -225776
35 (3,780 million shares in 2021 and 3,786 millio... NaN NaN NaN
36 ExxonMobil share of equity NaN 168,577 157,150
37 Noncontrolling interests NaN 7,106 6,980
38 Total equity NaN 175,683 164,130
39 Total liabilities and equity NaN 338,923 332,750
40 NaN NaN NaN NaN
41 The information in the Notes to Consolidated F... NaN NaN NaN
42 72 NaN NaN NaN
End of Exxon 2021 Balance Sheet Example¶

end of Financial Statements Section¶



Volatility:¶

Volatility accounts for the fluctuation in the stock price. A stock with high volatility will witness sharper price changes, making it a riskier investment. Let's see how volatility varies, on average, across economic sectors.


Theory: (Definitions):¶


Volatility:¶

Volatility: Meaning In Finance and How it Works with Stocks [Updated March 31, 2023]¶


Volatility is a measure of distribution of returns for a security or index. Higher volatility = riskier security
- Volatility is measured from:
    - the standard deviation or variance in returns from the security or index.

In the securities markets, volatility is often associated with big swings in either direction. 
e.g.
- when the stock market rises and falls more than one percent over a sustained period of time, it is called a volatile market. 
- An asset's volatility is a key factor when pricing options contracts.

OPTIONS AND DERIVATIVES > STRATEGY & EDUCATION > Volatility | Investopedia


Financial Securities¶

What Is a Security?¶
A "security" is a financial instrument with monetary value. 
- A security can represent:
    - owning a corporation (stock),
    - a creditor relationship with a government body / corporation (bond);
    - or rights to ownership (option).

INVESTING > INVESTING BASICS > Financial Securities | Investopedia


Call Option¶

What Is a Call Option? [Updated March 31, 2023]¶

Call options:
- financial contracts that give the option buyer the right but not the obligation to buy a:

- stock,
- bond,
- commodity or
- other asset / instrument

at a price, within a time period. 

The stock, bond, or commodity is the underlying asset. 

A call buyer profits when the underlying asset increases in price.

TRADING > OPTIONS AND DERIVATIVES > Call Option | Investopedia


Underlying Asset¶

Underlying Asset (Derivatives)—Definition, How It Works¶

Underlying asset are the financial assets upon which a derivative’s price is based. 

Options are an example of a derivative. 

A derivative is a financial instrument with a price that is based on a different asset.

TRADING SKILLS > TRADING BASIC EDUCATION > Underlying Asset


Derivative¶

Derivatives: Definition, Types, Considerations, and Pros and Cons, key points on these securitized contracts¶

Derivative : 
- a type of financial contract whose value is dependent on an underlying asset, group of assets, or benchmark. 
- set between 2 or more parties that can trade on an exchange or over-the-counter (OTC).

TRADING > OPTIONS AND DERIVATIVES > Derivative | Investopedia


Over the counter¶

Over-the-Counter (OTC): Definition; Trading and Security Types Defined¶


Over-the-counter (OTC)
- the process of trading securities via a broker-dealer network as opposed to on a centralized exchange like the New York Stock Exchange.

Over-the-counter trading can involve:
- stocks,
- bonds, and
- derivatives,
    - which are financial contracts that derive their value from an underlying asset such as a commodity.

STOCK TRADING > STOCK TRADING STRATEGY & EDUCATION > Over-the-Counter | Investopedia


Commodity¶

What Is a Commodity and Understanding Its Role in the Stock Market¶

A commodity is a basic good used in commerce that is interchangeable with other goods of the same type. Commodities are most often used as inputs in the production of other goods or services. A commodity thus usually refers to a raw material used to manufacture finished goods. A product, on the other hand, is the finished good sold to consumers.

ECONOMY > ECONOMICS > Commodity | Investopedia


Product¶

Commodity vs. Product: An Overview; What's the Difference?¶

Commodity and Product 
- (Often confused, used interchangeably)
- different when used by traders today. 
Commodity - a raw material used to manufacture finished goods
Product - the finished good sold to consumers

Commodities and products are part of the production and manufacturing process.
The main difference is where they are in the chain. 
Commodities are typically in the early stages of production.
Products fall at the final stage.

INVESTING > COMMODITIES > Product | Investopedia


Raw Materials¶

Raw Materials: Definition, Accounting, and Direct vs. Indirect¶

Raw materials 
- materials / substances used in the primary production or manufacturing of goods. 
- commodities bought and sold on commodities exchanges worldwide. 
- Businesses buy and sell raw materials in the factor market because raw materials are factors of production.

ECONOMY > ECONOMICS > Raw Materials | Investopedia


Factor Market¶

"Factor market" 
- a term economists use for all resources businesses use to purchase, rent, or hire what they need to produce goods / services. 
- Those needs are the factors of production, which include raw materials, land, labor, and capital.

The factor market is also called the input market.
- By this definition, all markets are either factor markets, where businesses obtain the resources they need,
    - or goods and services markets, where consumers make their purchases.

ECONOMY > ECONOMICS > Factor Market | Investopedia


Factors of Production¶

4 Factors of Production, Defined, Explained With Examples [Updated March 21, 2023]¶

Factors of production:
- inputs needed for creating a good or service
- include:
    - land,
    - labor,
    - entrepreneurship, and
    - capital.

Those who control the factors of production often enjoy the greatest wealth in a society. In capitalism, the factors of production are most often controlled by business owners and investors. In socialist systems, the government (or community) often exerts greater control over the factors of production.

CORPORATE FINANCE > ACCOUNTING > Factors of Production | Investopedia


Entrepreneur¶

Entrepreneur: What It Means to Be One and How to Get Started [Updated March 16, 2023]¶

Learn about the challenges facing entrepreneurs as they start new businesses¶
What Is an Entrepreneur?¶

An entrepreneur is an individual who creates a new business, bearing most of the risks and enjoying most of the rewards. The process of setting up a business is known as entrepreneurship. The entrepreneur is commonly seen as an innovator, a source of new ideas, goods, services, and business/or procedures.

Entrepreneurs play a key role in any economy, using the skills and initiative necessary to anticipate needs and bring good new ideas to market. Entrepreneurship that proves to be successful in taking on the risks of creating a startup is rewarded with profits, fame, and continued growth opportunities. Entrepreneurship that fails results in losses and less prevalence in the markets for those involved.

BUSINESS > BUSINESS ESSENTIALS > | Investopedia


Startup¶

What a Startup Is and What's Involved in Getting One Off the Ground¶

The term startup refers to a company in the first stages of operations. Startups are founded by one or more entrepreneurs who want to develop a product or service for which they believe there is demand. These companies generally start with high costs and limited revenue, which is why they look for capital from a variety of sources such as venture capitalists.

COMPANY PROFILES > STARTUPS | Investopedia


Venture Captialists:¶

A venture capitalist (VC) is a private equity investor that provides capital to companies with high growth potential in exchange for an equity stake. A VC investment could involve funding startup ventures or supporting small companies that wish to expand but have no access to the equities markets.

ALTERNATIVE INVESTMENTS PRIVATE EQUITY & VC > Venture Capitalists | Investopedia


Equity Markets¶

Equity Market: What It Is, How It Works, Types, and Examples¶

An equity market is a market in which shares of companies are issued and traded, either through exchanges or over-the-counter markets. Also known as the stock market, it is one of the most vital areas of a market economy. It gives companies access to capital to grow their business, and investors a piece of ownership in a company with the potential to realize gains in their investment based on the company's future performance.

MARKETS > STOCK MARKETS > Equity Market | Investopedia

Stock Market¶

What Is the Stock Market, What Does It Do, and How Does It Work?¶

What Is the Stock Market?¶

The term stock market refers to several exchanges in which shares of publicly held companies are bought and sold. 

Such financial activities are conducted through formal exchanges and via over-the-counter (OTC) marketplaces that operate under a defined set of regulations.



Both “stock market” and “stock exchange” are often used interchangeably. 

Traders in the stock market buy or sell shares on one or more of the stock exchanges that are part of the overall stock market.



The leading U.S. stock exchanges include the New York Stock Exchange (NYSE) and the Nasdaq.
KEY TAKEAWAYS¶

Stock markets are venues where buyers and sellers meet to exchange equity shares of public corporations.

Stock markets are components of a free-market economy because they enable democratized access to investor trading and exchange of capital.

Stock markets create efficient price discovery and efficient dealing.

The U.S. stock market is regulated by the Securities and Exchange Commission (SEC) and local regulatory bodies.

Understanding the Stock Market¶


The stock market allows buyers and sellers of securities to meet, interact, and transact. 

The markets allow for price discovery for shares of corporations and serve as a barometer for the overall economy. 

Buyers and sellers are assured of a fair price, high degree of liquidity, and transparency as market participants compete in the open market.

INVESTOPEDIA > INVESTING > Stock Market | Investopedia


The Economy¶

How the Stock Market Affects the U.S. Economy [Updated February 28, 2023]¶


“The stock market is not the economy” is a phrase that gets used quite often. 

Many pundits argue that the fluctuations of the major indexes tasked with tracking the performance of the country’s biggest companies have little impact on the average American, as the majority of shares trade hands among the super-wealthy.

2, 3


Moreover, the stock market can undergo bubbles emanating from hype, perception, and opinions of the agents that affect the stock prices. 

However, these perceptions do not necessarily reflect the real trading of goods and services, which in aggregate constitutes the economy.



While it’s true that the richest Americans own most of the stocks, it’s wrong to assume that nobody else is affected by how they are valued. Record numbers of American households are investing their savings in equities to secure their financial futures.

4

(1)

(1) MARKETS > STOCK MARKETS > The Economy | Investopedia


Changes in U.S. Family Finances from 2016 to 2019: Evidence from the Survey of Consumer Finances¶

The Federal Reserve Board’s triennial Survey of Consumer Finances (SCF) collects information about family income, net worth, balance sheet components, credit use, and other financial outcomes. (2)

The 2019 SCF reveals improvements in economic well-being among large parts of the income and wealth distributions since the previous time the survey was conducted in 2016, and many groups with historically lower income and wealth saw relatively large gains. (3)

(1)

(1) Changes in U.S. Family Finances from 2016 to 2019: Evidence from the Survey of Consumer Finances | Federal Reserve BULLETIN | September 2020; Vol. 106, No. 5 | Board of Governors of the Federal Reerve System | www.federalreserve.gov

(2) [ For a general description of the SCF data, see box 1, “The Data Used in This Article.” The appendix provides a summary of key technical aspects of the survey.]

(3) For a detailed discussion of the 2016 survey as well as references to earlier surveys, see Jesse Bricker, Lisa J. Dettling, Alice Henriques, Joanne W. Hsu, Lindsay Jacobs, Kevin B. Moore, Sarah Pack, John Sabelhaus, Jeffrey Thompson, and Richard Windle (2017), “Changes in U.S. Family Finances from 2013 to 2016: Evidence from the Survey of Consumer Finances,” Federal Reserve Bulletin, vol. 103 (September), https://www.federalreserve.gov/publications/files/ scf17.pdf.


Changes in U.S. Family Finances from 2013 to 2016: Evidence from the Survey of Consumer Finances¶

The Federal Reserve Board’s triennial Survey of Consumer Finances (SCF) collects information about family incomes, net worth, balance sheet components, credit use, and other financial outcomes. [2]
The 2016 SCF reveals broad-based gains in income and net worth since the previous time the survey was conducted, in 2013. [3]

[1]

[1] Changes in U.S. Family Finances from 2013 to 2016: Evidence from the Survey of Consumer Finances | Federal Reserve BULLETIN | September 2017; Vol 103, No. 3 | Board of Governors of the Feral Reserve System | www.federalreserve.gov

[2] See box 1, “The Data Used in This Article,” for a general description of the SCF data. The appendix to this article provides a summary of key technical aspects of the survey.

[3] For a detailed discussion of the 2013 survey as well as references to earlier surveys, see Jesse Bricker, Lisa J. Dettling, Alice Henriques, Joanne W. Hsu, Kevin B. Moore, John Sabelhaus, Jeffrey Thompson, and Richard Windle (2014), “Changes in U.S. Family Finances from 2010 to 2013: Evidence from the Survey of Consumer Finances,” Federal Reserve Bulletin, vol. 100 (September), https://www.federalreserve.gov/pubs/bulletin/2014/pdf/scf14.pdf.


Securities and Exchange Commission (SEC)¶

What Is the Securities and Exchange Commission (SEC)?
The U.S. Securities and Exchange Commission (SEC) is an independent federal government regulatory agency responsible for protecting investors, maintaining fair and orderly functioning of the securities markets, and facilitating capital formation. It was created by Congress in 1934 as the first federal regulator of the securities markets. The SEC promotes full public disclosure, protects investors against fraudulent and manipulative practices in the market, and monitors corporate takeover actions in the United States. It also approves registration statements for bookrunners among underwriting firms.

2, 3

[1]

[1] LAWS & REGULATIONS > SEC > Securities and Exchange Commission (SEC) | Investopedia

[2] The Role of the SEC | investor.gov

[3] What We Do | sec.gov


The securities markets¶

United States Stock Exchanges¶

Stock exchanges are marketplaces in which U.S.:
- financial securities,
- commodities,
- derivatives, and other
- financial instruments 
are traded. 

While in the past, traders and brokers used to meet physically in a stock exchange building to trade stocks, now most of the financial trading happens electronically and automatically. 

Still, each exchange has its own unique listing requirements for companies that wish to join. 

As a baseline, stock exchanges require regular:
- financial reports,
- audited earnings, and
- minimal capital requirements.

MARKETS > US MARKETS > Stock Exchanges | Investopedia


Stock exchanges / exchanges:¶

Exchanges: Definition, Explanation, Types and Examples¶

An exchange is a marketplace where securities, commodities, derivatives and other financial instruments are traded. The core function of an exchange is to ensure fair and orderly trading and the efficient dissemination of price information for any securities trading on that exchange. Exchanges give companies, governments, and other groups a platform from which to sell securities to the investing public.

INVESTING > MARKETS > Exchanges | Investopedia


Mutual Funds: Definition, Different Types and How They Are Priced [Updated March 13, 2023]¶

A mutual fund is a financial vehicle that pools assets from shareholders to invest in securities like:
- stocks,
- bonds,
- money market instruments, and
- other assets.
Mutual funds are operated by professional money managers,
- who allocate:
    - the fund's assets
- and attempt to produce:
    - capital gains or
    - income 
for the fund's investors. 

A mutual fund's portfolio is structured and maintained to match the investment objectives stated in its prospectus.

INVESTING > GUIDE TO MUTUAL FUNDS | Investopedia


Rate of Return (Investopedia & sec.gov)¶

Rate of Return (RoR) Meaning, Formula, and Examples¶

What Is a Rate of Return (RoR)?
A rate of return (RoR) is:
- the net gain or
- loss

of an investment 

over a specified time period,

expressed as a percentage of the investment’s initial cost.

2

When calculating the rate of return, 

- you are determining:

    - the percentage change:

        - from the beginning of the period until the end.

[1]

[1] CORPORATE FINANCE > FINANCIAL RATIOS > Rate of Return | Investopedia

[2] Rate of Return | sec.gov


Rate of Return (sec.gov)¶

The annual rate of return is the percentage change in the value of an investment.

For example: If you assume you earn a 10% annual rate of return, then you are assuming that the value of your investment will increase by 10% every year. So, if you invest $1,000 for 1 year, then your investment would be worth $1,100 at the end of the one year period, before subtracting expenses.

[1]

[1] Rate of Return | sec.gov

alternative link to 1


Prospectus¶

What Is a Prospectus? Example, Uses, and How to Read It¶

A prospectus is a formal document:
- required by and
- filed with
    - the Securities and Exchange Commission (SEC)

that provides details about an investment offering to the public. 

A prospectus is filed for offerings of:
- stocks,
- bonds, and
- mutual funds.

The prospectus can help investors make more informed investment decisions because it contains a host of relevant information about the investment or security. 

In areas other than investing,:
- a prospectus is a printed document that advertises or describes an offering such as a:
    - school,
    - commercial enterprise,
    - forthcoming book, etc. 

All forms of prospectus exist to:
- attract or inform:
    - clients,
    - members,
    - buyers, or
    - investors.

INVESTING > INVESTING BASICS > Prospectus | Investopedia



Money Manager¶

Money Manager: Definition, Duties, Examples, Compensation¶

A money manager is a person or financial firm:
- that manages the securities portfolio of:
    - an individual or
    - institutional investor. 

Typically, a money manager employs people with various expertise ranging from:
- research and selection of:
    - investment options to 
- monitoring the assets and deciding when to sell them.


In return for a fee,:
- the money manager has the fiduciary duty:
    - to choose and manage investments prudently for clients, including:
        - developing an appropriate investment strategy and 
            - buying and selling securities 
        - to meet those goals. 

A money manager may also be known as a:
- "portfolio manager,"
- "asset manager," or
- "investment manager."

FUND TRADING > HEDGE FUNDS > Money Manager | Investopedia


Fiduciary¶

Fiduciary Definition: Examples and Why They Are Important¶

A fiduciary is a person or organization that acts on behalf of another person or persons, putting their clients’ interests ahead of their own, with a duty to preserve good faith and trust. 

Being a fiduciary thus requires being bound both legally and ethically to act in the other’s best interests.

INVESTOPEDIA > FINANCIAL ADVISOR > Fiduciary| Investopedia


Good Faith¶

What Is the Doctrine of Utmost Good Faith in Insurance?¶

What Is the Doctrine Of Utmost Good Faith?¶

The doctrine of utmost good faith, also known by its Latin name uberrimae fidei, is a minimum standard, legally obliging all parties entering a contract to act honestly and not mislead or withhold critical information from one another. 

It applies to many everyday financial transactions and is one of the most fundamental doctrines in insurance law.

ECONOMY > ECONOMICS > Good Faith | Investopedia


Insurance: Definition, How It Works, and Main Types of Policies [Updated April 20, 2023]¶

Insurance is a:
- contract,
    - represented by a policy,
        - in which a policyholder receives:
            - financial protection or
            - reimbursement against losses
        - from an insurance company. 

The company pools clients’ risks to make payments more affordable for the insured. 

Most people have some insurance: for:
- their car,
- their house,
- their healthcare, or
- their life.

Insurance policies hedge against financial losses resulting from accidents, injury, or property damage. Insurance also helps cover costs associated with liability (legal responsibility) for damage or injury caused to a third party.

2

[1]

[1] PERSONAL FINANCE > INSURANCE | Investopedia

[2] Building Blocks Student Handout | What is insurance? | consumerfinance.gov


Hedge¶

Hedge Definition: What It Is and How It Works in Investing¶

To hedge, in finance, is to:
- take an offsetting position in an:
    - asset or investment 
- that reduces the price risk:
    - of an existing position. 

A hedge is therefore a:
- trade:
    - that is made with the purpose of reducing the risk of:
        - adverse price movements in another asset. 

Normally,:
- a hedge consists of :
    - taking the opposite position:
        - in a related security or 
        - in a derivative security
    - based on the asset to be hedged.

TRADING STRATEGIES ADVANCED STRATEGIES & INSTRUMENTS | Investopedia


Portfolio¶

Financial Portfolio: What It Is, and How to Create and Manage One¶

A portfolio is a collection of financial investments like:
- stocks,
- bonds,
- commodities,
- cash, and
- cash equivalents,

including:
- closed-end funds and
- exchange traded funds (ETFs). 

People generally believe that:
- stocks,
- bonds, and
- cash

comprise the core of a portfolio. 

Though this is often the case,:
- it does not need to be the rule. 

A portfolio may contain a wide range of assets including:
- real estate,
- art, and
- private investments.

INVESTING > PORTFOLIO MANAGEMENT > Portfolio| Investopedia


Closed-End Fund¶

A closed-end fund is a type of mutual fund that issues a fixed number of shares through a single initial public offering (IPO) to raise capital for its initial investments. 

Its shares can then be bought and sold on a stock exchange but no new shares will be created and no new money will flow into the fund.


In contrast, an open-ended fund, such as most mutual funds and exchange-traded funds (ETFs), accepts a constant flow of new investment capital. It issues new shares and buys back its own shares on demand.


Many municipal bond funds and some global investment funds are closed-end funds.

INVESTING > GUIDE TO MUTUAL FUNDS > Closed-End Fund | Investopedia


Exchange-Traded Fund (ETF)¶

Exchange-Traded Fund (ETF), Definition, Explanation With Pros and Cons [Updated April 18, 2023]¶

An exchange-traded fund (ETF) is a type of pooled investment security that operates much like a mutual fund. Typically, ETFs will track a particular index, sector, commodity, or other assets, but unlike mutual funds, ETFs can be purchased or sold on a stock exchange the same way that a regular stock can. An ETF can be structured to track anything from the price of an individual commodity to a large and diverse collection of securities. ETFs can even be structured to track specific investment strategies.


The first ETF was the SPDR S&P 500 ETF (SPY), which tracks the S&P 500 Index, and which remains an actively traded ETF today.

KEY TAKEAWAYS


- An exchange-traded fund (ETF) is a basket of securities that trades on an exchange just like a stock does.
- ETF share prices fluctuate all day as the ETF is bought and sold; this is different from mutual funds, which only trade once a day after the market closes.

2

- ETFs can contain all types of investments, including stocks, commodities, or bonds; some offer U.S.-only holdings, while others are international.
- ETFs offer low expense ratios and fewer broker commissions than buying the stocks individually.

Understanding Exchange-Traded Funds (ETFs)¶


An ETF is called an exchange-traded fund because it’s traded on an exchange just like stocks are. 

The price of an ETF’s shares will change throughout the trading day as the shares are bought and sold on the market. 

This is unlike mutual funds, which are not traded on an exchange, and which trade only once per day after the markets close. 

Additionally, ETFs tend to be more cost-effective and more liquid compared to mutual funds.

[1]

[1] Exchange-Traded Fund (ETF)

[2] The Incredible Shrinking Fee


ETF v Mutual Fund¶

ETF vs. Mutual Fund: What's the Difference?¶

ETFs vs. Mutual Fund: An Overview¶

Investors face a bewildering array of choices:
- stocks or bonds,
- domestic or international, 
- different sectors and industries,
- value or growth, etc. 

Deciding whether to buy a:
- mutual fund or
- exchange-traded fund (ETF) 

may seem like a trivial consideration next to all the others,

but there are key differences between the two types of funds that can affect how much money you make and how you make it.


Both mutual funds and ETFs hold portfolios of stocks and/or bonds and occasionally something more exotic, such as:
- precious metals or
- commodities. 

They must adhere to the same regulations concerning:
- what they can own,
- how much can be concentrated in one or a few holdings,
- how much money they can borrow in relation to the portfolio size, and more.


Beyond those elements, the paths diverge. 

Some of the differences may seem obscure,
- but they can make one type of fund or the other a better fit for your needs.

KEY TAKEAWAYS


- Both mutual funds and ETFs hold portfolios of stocks and/or bonds and occasionally something more exotic, such as precious metals or commodities.
- Both can track indexes as well, however ETFs tend to be more cost effective and more liquid as they trade on exchanges like shares of stock.
- Mutual funds can provide some benefits such as active management and greater regulatory oversight, but only allow transactions once per day and tend to have higher costs.

[1]

[1] INVESTOPEDIA > INVESTING > Differences between ETFs and Mutual Funds | Investopedia


Liquidity¶

Understanding Liquidity, Definition, and How to Measure It [Updated March 14, 2023]¶

Liquidity refers to the:
- efficiency or
- ease 
with which an:
- asset or
- security
can be converted into:
- ready cash 
without affecting its market price. 

The most liquid asset of all is cash itself.

TRADING SKILLS > TRADING BASIC EDUCATION > Liquidity | Investopedia


Market Price¶

Market Price: Definition, Meaning, How To Determine, and Example¶

The market price is the current price at which an asset or service can be bought or sold. 

The market price of an:
- asset or
- service
is determined by the:
- forces of supply and 
- demand. 

The price at which quantity supplied equals quantity demanded is the:
- market price.



The market price is used to calculate consumer and economic surplus. 

Consumer surplus refers to the difference between the:
- highest price a consumer is willing to pay for a good and 
- the actual price they do pay for the good, or 
    - the market price. 

Economic surplus refers to two related quantities: 
- consumer surplus and 
- producer surplus. 

Producer surplus may also be referred to as profit:
- it is the amount that producers benefit by selling at the market price 
    - (provided that the market price is higher than the least that they would be willing to sell for).
- Economic surplus is the sum total of consumer surplus and producer surplus.

ECONOMICS > GUIDE TO MICROECONOMICS > Market Price


calculate consumer and economic surplus¶

Consumer Surplus vs. Economic Surplus: Overview, What's the Difference?¶

In mainstream economics, consumer surplus is the difference between the highest price a consumer is willing to pay and the actual price they do pay for the good (which is the market price of the good). In other words, consumer surplus is the difference between what a consumer is willing to pay and what they actually pay for a good or service.

ECONOMICS > GUIDE TO MICROECONOMICS > calculate consumer and economic surplus | Investopedia


Consumer Surplus¶

Consumer Surplus Definition, Measurement, and Example [Updated March 19, 2023]¶

Consumer surplus is an economic measurement of consumer benefits resulting from market competition. 

A consumer surplus happens when the price that consumers pay for a product or service is:
- less than the price they're willing to pay. 

It's a measure of the additional benefit that consumers receive 
- because they're paying less for something than what they were willing to pay.

ECONOMY > ECONOMICS > Consumer Surplus | Investopedia


Surplus¶

What Is a Surplus? Definition, Reasons, and Consequences¶

A surplus describes the amount of an asset or resource that exceeds the portion that's actively utilized. 

A surplus can refer to a host of different items, including:
- income,
- profits,
- capital, and
- goods. 

In the context of inventories,: 
- a surplus describes:
    - products that remain sitting on store shelves, unpurchased. 

In budgetary contexts,:
- a surplus occurs when:
    - income earned exceeds expenses paid. 

A budget surplus:
- can also occur within governments when there's:
    - leftover tax revenue
    - after all government programs
    - are fully financed.

CORPORATE FINANCE > ACCOUNTING > Surplus | Investopedia


Budget Surplus¶

What Is a Budget Surplus? What's the Impact, and Pros & Cons?¶

The term budget surplus refers to a situation that occurs when income exceeds expenditures. 

The term is often used to describe a corporation or government's financial state, unlike individuals who have savings instead of budget surpluses. 

A surplus indicates that a government's finances are being effectively managed. 

The opposite of a budget surplus is a budget deficit, which commonly occurs when spending exceeds income.

KEY TAKEAWAYS

A budget surplus is when income or revenue exceeds expenditures.
Governments and companies with surpluses have additional money that can be reinvested or used to pay off debts.
The opposite of a surplus is a deficit, which occurs when spending exceeds revenues.
The last time the U.S. ran a budget surplus was in 2001 under President Bill Clinton.

2

The U.S. budget had a deficit of more than $421 billion as of January 2023.

3

[1]

[1] GOVERNMENT SPENDING & DEBT > GOVERNMENT SPENDING > Budget Surplus | Investopedia

[2] Historical Tables | whitehouse.gov

[3] What is the national deficit?

end of Business Definitions and Theory section¶



Volatility versus GICS Sector barplot¶

In [155]:
plt.figure(figsize=(5,1))
sns.barplot(data=df, x='GICS Sector', y='Volatility', ci=False)  ## Complete the code to choose the right variables
plt.xticks(rotation=90)
plt.show()

end of section on Volatility versus GICS Sector barplot¶

Results:¶

Volatility versus GICS Sector:¶

From the Above barplot of Volatility versus GICS Sector:

  • Energy had, by far, the highest volatility at over 2.5.
  • Materials had the 2nd highest volatility at around just over 1.75
  • Information Technology, Consumer Discretionary, and Health Care had the 3rd, 4th and 5th highest volatility scores, respectively, all over 1.5
  • Industrials had the 6th highest volatility at almost 1.5.
  • Telecommunications Services had the 7th highest volatility at around over 1.25.
  • Financials had the 8th highest volatility at around 1.25.
  • Real Estate had the 9th highest volatility of around just under 1.25.
  • Consumer Staples and Utilities had the 10th and 11th highest volatility scores, respectively, both just over 1.0.

Data Preprocessing¶

Outlier Check¶

  • Let's plot the boxplots of all numerical columns to check for outliers.
In [156]:
plt.figure(figsize=(15, 12))

numeric_columns = df.select_dtypes(include=np.number).columns.tolist()

for i, variable in enumerate(numeric_columns):
    plt.subplot(3, 4, i + 1)
    plt.boxplot(df[variable], whis=1.5)
    plt.tight_layout()
    plt.title(variable)

plt.show()

Scaling¶

  • Let's scale the data before we proceed with clustering.
  • sklearn.preprocessing.StandardScaler

  • class

    • sklearn.preprocessing.StandardScaler(

      *,

      copy=True,

      with_mean=True,

      with_std=True

      )

  • Standardize features by removing the mean and scaling to unit variance.

  • The standard score of a sample x is calculated as:

        z = (x - u) / s
  • where u is the mean of the training samples or zero if with_mean=False, and s is the standard deviation of the training samples or one if with_std=False.

  • Centering and scaling happen independently on each feature by computing the relevant statistics on the samples in the training set. Mean and standard deviation are then stored to be used on later data using:

      - transform.

sklearn.preprocessing.StandardScaler | transform(X, copy=None)

transform(X, copy=None)

Perform standardization by centering and scaling.

Parameters:¶

X:{array-like, sparse matrix of shape (n_samples, n_features)}

The data used to scale along the features axis.

copy : bool, default=None Copy the input X or not.

Returns:¶

X_tr : {ndarray, sparse matrix} of shape (n_samples, n_features)

Transformed array.


Standardization of a dataset is a common requirement for many machine learning estimators: they might behave badly if the individual features do not more or less look like standard normally distributed data (e.g. Gaussian with 0 mean and unit variance).

For instance many elements used in the objective function of a learning algorithm (such as the RBF kernel of Support Vector Machines or the L1 and L2 regularizers of linear models) assume that all features are centered around 0 and have variance in the same order. If a feature has a variance that is orders of magnitude larger than others, it might dominate the objective function and make the estimator unable to learn from other features correctly as expected.

This scaler can also be applied to sparse CSR or CSC matrices by passing with_mean=False to avoid breaking the sparsity structure of the data.


sklearn.preprocessing.StandardScaler.transform

Compressed Sparse formats CSR and CSC in Python%20and,with%20a%20column%2Dmajor%20order.)

Compressed sparse row (CSR) and

compressed sparse column (CSC)

  • are widely known and most used formats of sparse data structures.

  • Mainly, they are used for write-once-read-many tasks.

Compressed Sparse Column (CSC) format is almost identical,

  • except that values are indexed first
    • by column
      • with a column-major order.

Usually, the CSC is used when there are:

  • more rows than columns. ((narrow))

On the contrary,:

  • the CSR works better for a ‘wide’ format. So, here is an example of CSR.
  • Compressed Sparse formats CSR and CSC in Python%20and,with%20a%20column%2Dmajor%20order.)

Internally, CSR is based on three NumPy arrays:

  • data is an array of corresponding nonzero values
  • indices is array of column indices
  • indptr points to row starts in data and indices ~ length of indptr is:
    • number of rows + 1,
  • last item in indptr = number of nonvalues = length of both data and indices

~ nonzero items of the i-th row are located data[indptr[i]:indptr[i+1]] with column indices indices[indptr[i]:indptr[i+1]]

If you’re new to the SciPy sparse matrix game, you might find yourself stymied by the ‘indptr’ array, which can be used to instantiate a csc_matrix or a csr_matrix object. Here I give an example to explain how to compute matrix through NumPy arrays.

6.3. Preprocessing data The sklearn.preprocessing package provides several common utility functions and transformer classes to change raw feature vectors into a representation that is more suitable for the downstream estimators.

In general, learning algorithms benefit from standardization of the data set. If some outliers are present in the set, robust scalers or transformers are more appropriate. The behaviors of the different scalers, transformers, and normalizers on a dataset containing marginal outliers is highlighted in Compare the effect of different scalers on data with outliers.

6.3.1. Standardization, or mean removal and variance scaling


Standardization of datasets is a common requirement for many machine learning estimators implemented in scikit-learn; they might behave badly if the individual features do not more or less look like standard normally distributed data: Gaussian with zero mean and unit variance.

In practice we often ignore the shape of the distribution and just transform the data to center it by removing the mean value of each feature, then scale it by dividing non-constant features by their standard deviation.

For instance, many elements used in the objective function of a learning algorithm (such as the RBF kernel of Support Vector Machines or the l1 and l2 regularizers of linear models) may assume that all features are centered around zero or have variance in the same order. If a feature has a variance that is orders of magnitude larger than others, it might dominate the objective function and make the estimator unable to learn from other features correctly as expected.

6.3.1. Standardization, or mean removal and variance scaling | Continued | Sklearn

>>> from sklearn import preprocessing
>>> import numpy as np
>>> X_train = np.array([[ 1., -1.,  2.],
...                     [ 2.,  0.,  0.],
...                     [ 0.,  1., -1.]])
>>> scaler = preprocessing.StandardScaler().fit(X_train)
>>> scaler
StandardScaler()

>>> scaler.mean_
array([1. ..., 0. ..., 0.33...])

>>> scaler.scale_
array([0.81..., 0.81..., 1.24...])

Attributes:¶

scale_ndarray of shape (n_features,) or None¶

Per feature relative scaling of the data to achieve zero mean and unit variance. Generally this is calculated using np.sqrt(var_). If a variance is zero, we can’t achieve unit variance, and the data is left as-is, giving a scaling factor of 1.

scale_ is equal to None when with_std=False.

In [157]:
# scaling the data before clustering
scaler = StandardScaler()
subset = df[numeric_columns].copy()  ## Complete the code to scale the data
subset_scaled = scaler.fit_transform(subset)
In [158]:
# creating a dataframe of the scaled data
subset_scaled_df = pd.DataFrame(subset_scaled, columns=subset.columns)

K-means Clustering¶

Checking Elbow Plot¶

In [159]:
k_means_df = subset_scaled_df.copy()
In [160]:
clusters = range(1, 15)
meanDistortions = []

for k in clusters:
    model = KMeans(n_clusters=k, random_state=1)
    model.fit(subset_scaled_df)
    prediction = model.predict(k_means_df)
    distortion = (
        sum(np.min(cdist(k_means_df, model.cluster_centers_, "euclidean"), axis=1))
        / k_means_df.shape[0]
    )

    meanDistortions.append(distortion)

    print("Number of Clusters:", k, "\tAverage Distortion:", distortion)

plt.plot(clusters, meanDistortions, "bx-")
plt.xlabel("k")
plt.ylabel("Average Distortion")
plt.title("Selecting k with the Elbow Method", fontsize=20)
plt.show()
Number of Clusters: 1 	Average Distortion: 2.5425069919221697
Number of Clusters: 2 	Average Distortion: 2.382318498894466
Number of Clusters: 3 	Average Distortion: 2.2692367155390745
Number of Clusters: 4 	Average Distortion: 2.1745559827866363
Number of Clusters: 5 	Average Distortion: 2.128799332840716
Number of Clusters: 6 	Average Distortion: 2.080400099226289
Number of Clusters: 7 	Average Distortion: 2.0289794220177395
Number of Clusters: 8 	Average Distortion: 1.964144163389972
Number of Clusters: 9 	Average Distortion: 1.9221492045198068
Number of Clusters: 10 	Average Distortion: 1.8513913649973124
Number of Clusters: 11 	Average Distortion: 1.8024134734578485
Number of Clusters: 12 	Average Distortion: 1.7900931879652673
Number of Clusters: 13 	Average Distortion: 1.7417609203336912
Number of Clusters: 14 	Average Distortion: 1.673559857259703
In [161]:
model = KMeans(random_state=1)
visualizer = KElbowVisualizer(model, k=(1, 15), timings=True)
visualizer.fit(k_means_df)  # fit the data to the visualizer
visualizer.show()  # finalize and render figure
Out[161]:
<Axes: title={'center': 'Distortion Score Elbow for KMeans Clustering'}, xlabel='k', ylabel='distortion score'>

Let's check the silhouette scores¶

In [162]:
sil_score = []
cluster_list = range(2, 15)
for n_clusters in cluster_list:
    clusterer = KMeans(n_clusters=n_clusters, random_state=1)
    preds = clusterer.fit_predict((subset_scaled_df))
    score = silhouette_score(k_means_df, preds)
    sil_score.append(score)
    print("For n_clusters = {}, the silhouette score is {})".format(n_clusters, score))

plt.plot(cluster_list, sil_score)
plt.show()
For n_clusters = 2, the silhouette score is 0.43969639509980457)
For n_clusters = 3, the silhouette score is 0.4644405674779404)
For n_clusters = 4, the silhouette score is 0.4577225970476733)
For n_clusters = 5, the silhouette score is 0.43228336443659804)
For n_clusters = 6, the silhouette score is 0.4005422737213617)
For n_clusters = 7, the silhouette score is 0.3976335364987305)
For n_clusters = 8, the silhouette score is 0.40278401969450467)
For n_clusters = 9, the silhouette score is 0.3778585981433699)
For n_clusters = 10, the silhouette score is 0.13458938329968687)
For n_clusters = 11, the silhouette score is 0.1421832155528444)
For n_clusters = 12, the silhouette score is 0.2044669621527429)
For n_clusters = 13, the silhouette score is 0.23424874810104204)
For n_clusters = 14, the silhouette score is 0.12102526472829901)
In [163]:
model = KMeans(random_state=1)
visualizer = KElbowVisualizer(model, k=(2, 15), metric="silhouette", timings=True)
visualizer.fit(k_means_df)  # fit the data to the visualizer
visualizer.show()  # finalize and render figure
Out[163]:
<Axes: title={'center': 'Silhouette Score Elbow for KMeans Clustering'}, xlabel='k', ylabel='silhouette score'>
In [164]:
# finding optimal no. of clusters with silhouette coefficients
visualizer = SilhouetteVisualizer(KMeans(6, random_state=1))  ## Complete the code to visualize the silhouette scores for certain number of clusters
visualizer.fit(k_means_df)
visualizer.show()
Out[164]:
<Axes: title={'center': 'Silhouette Plot of KMeans Clustering for 340 Samples in 6 Centers'}, xlabel='silhouette coefficient values', ylabel='cluster label'>

Creating Final Model¶

In [165]:
# final K-means model
kmeans = KMeans(n_clusters=6, random_state=1)  ## Complete the code to choose the number of clusters
kmeans.fit(k_means_df)
Out[165]:
KMeans(n_clusters=6, random_state=1)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
KMeans(n_clusters=6, random_state=1)
In [166]:
# creating a copy of the original data
df1 = df.copy()

# adding kmeans cluster labels to the original and scaled dataframes
k_means_df["KM_segments"] = kmeans.labels_
df1["KM_segments"] = kmeans.labels_

Cluster Profiling¶

In [167]:
df1.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 340 entries, 0 to 339
Data columns (total 16 columns):
 #   Column                        Non-Null Count  Dtype  
---  ------                        --------------  -----  
 0   Ticker Symbol                 340 non-null    object 
 1   Security                      340 non-null    object 
 2   GICS Sector                   340 non-null    object 
 3   GICS Sub Industry             340 non-null    object 
 4   Current Price                 340 non-null    float64
 5   Price Change                  340 non-null    float64
 6   Volatility                    340 non-null    float64
 7   ROE                           340 non-null    int64  
 8   Cash Ratio                    340 non-null    int64  
 9   Net Cash Flow                 340 non-null    int64  
 10  Net Income                    340 non-null    int64  
 11  Earnings Per Share            340 non-null    float64
 12  Estimated Shares Outstanding  340 non-null    float64
 13  P/E Ratio                     340 non-null    float64
 14  P/B Ratio                     340 non-null    float64
 15  KM_segments                   340 non-null    int32  
dtypes: float64(7), int32(1), int64(4), object(4)
memory usage: 41.3+ KB

python boolean or

Debugging:¶

  • from previous issue pandas.DataFrame.groupby
  • for debugging current issue: pandas.DataFrame.to_string

  • Error: TypeError: unsupported operand type(s) for |: 'str' and 'str'


Error: TypeError: unsupported operand type(s) for |: 'str' and 'str'

In [168]:
df1.columns
Out[168]:
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
In [169]:
df1_num_cols=[]
df1_obj_cols=[]
for iterable in df.columns:
    if (df1.columns.dtype == 'float64' or 'int64' or 'int32'):
        df1_num_cols.append(iterable)
        # print(df1.columns.dtype == 'float64' or 'int64' or 'int32')
        print(df1.columns.dtype)
        print(df1.columns)
        # print(iterable)
        # print(df1.columns.dtype)
    else:
        df1_obj_cols.append(iterable)
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
object
Index(['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry',
       'Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio',
       'KM_segments'],
      dtype='object')
In [170]:
df1_num_cols
Out[170]:
['Ticker Symbol',
 'Security',
 'GICS Sector',
 'GICS Sub Industry',
 'Current Price',
 'Price Change',
 'Volatility',
 'ROE',
 'Cash Ratio',
 'Net Cash Flow',
 'Net Income',
 'Earnings Per Share',
 'Estimated Shares Outstanding',
 'P/E Ratio',
 'P/B Ratio']
In [171]:
df1_obj_cols
Out[171]:
[]

pandas.DataFrame.to_string scipy.sparse.csr_matrix


pandas.DataFrame.groupby

arrays = [['Falcon', 'Falcon', 'Parrot', 'Parrot'],
          ['Captive', 'Wild', 'Captive', 'Wild']]
index = pd.MultiIndex.from_arrays(arrays, names=('Animal', 'Type'))
df = pd.DataFrame({'Max Speed': [390., 350., 30., 20.]},
                  index=index)
df
                Max Speed
Animal Type
Falcon Captive      390.0
       Wild         350.0
Parrot Captive       30.0
       Wild          20.0
df.groupby(level=0).mean()
        Max Speed

Takeaway:

  • Use df, setup with index then groupby.
In [172]:
df1.head(1)
Out[172]:
Ticker Symbol Security GICS Sector GICS Sub Industry Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio KM_segments
0 AAL American Airlines Group Industrials Airlines 42.349998 9.999995 1.687151 135 51 -604000000 7610000000 11.39 668129938.5 3.718174 -8.784219 0
In [173]:
df1.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 340 entries, 0 to 339
Data columns (total 16 columns):
 #   Column                        Non-Null Count  Dtype  
---  ------                        --------------  -----  
 0   Ticker Symbol                 340 non-null    object 
 1   Security                      340 non-null    object 
 2   GICS Sector                   340 non-null    object 
 3   GICS Sub Industry             340 non-null    object 
 4   Current Price                 340 non-null    float64
 5   Price Change                  340 non-null    float64
 6   Volatility                    340 non-null    float64
 7   ROE                           340 non-null    int64  
 8   Cash Ratio                    340 non-null    int64  
 9   Net Cash Flow                 340 non-null    int64  
 10  Net Income                    340 non-null    int64  
 11  Earnings Per Share            340 non-null    float64
 12  Estimated Shares Outstanding  340 non-null    float64
 13  P/E Ratio                     340 non-null    float64
 14  P/B Ratio                     340 non-null    float64
 15  KM_segments                   340 non-null    int32  
dtypes: float64(7), int32(1), int64(4), object(4)
memory usage: 41.3+ KB


From: 'notebooks/USL_W2_AdditionalCaseStudy_ProductSegmentation+%281%29+%281%29+%281%29.ipynb':


Pandas.mean() TypeError: Could not convert to numeric https://stackoverflow.com/questions/44522741/pandas-mean-typeerror-could-not-convert-to-numeric


Debugging [Resolved]: Search string: 'groupby keep strings but run mean could not convert to numeric'

data.groupby('month', as_index=False).agg({"duration": "sum"}) Use Pandas Groupby to Group and Summarise DataFrames

solution:

groupby all string columns

as follows:


but first:


Debugging[Resolved]:

search string: groupby ValueError: 2

Pandas groupby throwing up ValueError

  • pandas.core.groupby.DataFrameGroupBy.agg

Solution:

Remove:

, as_index=False

from

.groupby() passed into method call


In [174]:
df1.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 340 entries, 0 to 339
Data columns (total 16 columns):
 #   Column                        Non-Null Count  Dtype  
---  ------                        --------------  -----  
 0   Ticker Symbol                 340 non-null    object 
 1   Security                      340 non-null    object 
 2   GICS Sector                   340 non-null    object 
 3   GICS Sub Industry             340 non-null    object 
 4   Current Price                 340 non-null    float64
 5   Price Change                  340 non-null    float64
 6   Volatility                    340 non-null    float64
 7   ROE                           340 non-null    int64  
 8   Cash Ratio                    340 non-null    int64  
 9   Net Cash Flow                 340 non-null    int64  
 10  Net Income                    340 non-null    int64  
 11  Earnings Per Share            340 non-null    float64
 12  Estimated Shares Outstanding  340 non-null    float64
 13  P/E Ratio                     340 non-null    float64
 14  P/B Ratio                     340 non-null    float64
 15  KM_segments                   340 non-null    int32  
dtypes: float64(7), int32(1), int64(4), object(4)
memory usage: 41.3+ KB
In [175]:
df1.groupby(["KM_segments", "Ticker Symbol", "Security", "GICS Sector", "GICS Sub Industry"])
Out[175]:
<pandas.core.groupby.generic.DataFrameGroupBy object at 0x000002CDB5755670>
In [176]:
df1.groupby(["KM_segments", "Ticker Symbol", "Security", "GICS Sector", "GICS Sub Industry"]).mean()
Out[176]:
Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio
KM_segments Ticker Symbol Security GICS Sector GICS Sub Industry
0 AAL American Airlines Group Industrials Airlines 42.349998 9.999995 1.687151 135.0 51.0 -604000000.0 7.610000e+09 11.39 6.681299e+08 3.718174 -8.784219
ABBV AbbVie Health Care Pharmaceuticals 59.240002 8.339433 2.197887 130.0 77.0 51000000.0 5.144000e+09 3.15 1.633016e+09 18.806350 -8.750068
ABT Abbott Laboratories Health Care Health Care Equipment 44.910000 11.301121 1.273646 21.0 67.0 938000000.0 4.423000e+09 2.94 1.504422e+09 15.275510 -0.394171
ADM Archer-Daniels-Midland Co Consumer Staples Agricultural Products 36.680000 -12.017268 1.516493 10.0 49.0 -189000000.0 1.849000e+09 2.99 6.183946e+08 12.267559 7.496831
AEE Ameren Corp Utilities MultiUtilities 43.230000 2.174424 1.124186 9.0 14.0 287000000.0 6.360000e+08 2.60 2.446154e+08 16.626923 -0.719497
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
5 SE Spectra Energy Corp. Energy Oil & Gas Refining & Marketing & Transportation 23.940001 -9.898378 2.030786 3.0 6.0 -2000000.0 1.960000e+08 0.29 6.758621e+08 82.551728 -2.580408
SWN Southwestern Energy Energy Oil & Gas Exploration & Production 7.110000 -44.798137 4.580042 200.0 2.0 -38000000.0 -4.556000e+09 -6.07 4.021417e+08 93.089287 1.273530
TDC Teradata Corp. Information Technology Application Software 26.420000 -8.833678 2.730659 25.0 88.0 5000000.0 -2.140000e+08 -1.53 1.398693e+08 74.555557 4.068084
WMB Williams Cos. Energy Oil & Gas Exploration & Production 25.700001 -30.988186 3.719560 9.0 4.0 -140000000.0 -5.710000e+08 -0.76 7.513158e+08 93.089287 -14.561121
XEC Cimarex Energy Energy Oil & Gas Exploration & Production 89.379997 -14.403372 2.397940 86.0 190.0 373520000.0 -2.408948e+09 -25.92 9.293781e+07 93.089287 7.186128

340 rows × 11 columns

In [177]:
km_cluster_profile = df1.groupby(["KM_segments", "Ticker Symbol", "Security", "GICS Sector", "GICS Sub Industry"]).mean()  ## Complete the code to groupby the cluster labels
In [178]:
km_cluster_profile["count_in_each_segment"] = (
    df1.groupby(["KM_segments", "Ticker Symbol", "Security", "GICS Sector", "GICS Sub Industry"])["Security"].count().values  ## Complete the code to groupby the cluster labels
)
In [179]:
km_cluster_profile.style.highlight_max(color="lightgreen", axis=0)
Out[179]:
          Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio count_in_each_segment
KM_segments Ticker Symbol Security GICS Sector GICS Sub Industry                        
0 AAL American Airlines Group Industrials Airlines 42.349998 9.999995 1.687151 135.000000 51.000000 -604000000.000000 7610000000.000000 11.390000 668129938.500000 3.718174 -8.784219 1
ABBV AbbVie Health Care Pharmaceuticals 59.240002 8.339433 2.197887 130.000000 77.000000 51000000.000000 5144000000.000000 3.150000 1633015873.000000 18.806350 -8.750068 1
ABT Abbott Laboratories Health Care Health Care Equipment 44.910000 11.301121 1.273646 21.000000 67.000000 938000000.000000 4423000000.000000 2.940000 1504421769.000000 15.275510 -0.394171 1
ADM Archer-Daniels-Midland Co Consumer Staples Agricultural Products 36.680000 -12.017268 1.516493 10.000000 49.000000 -189000000.000000 1849000000.000000 2.990000 618394648.800000 12.267559 7.496831 1
AEE Ameren Corp Utilities MultiUtilities 43.230000 2.174424 1.124186 9.000000 14.000000 287000000.000000 636000000.000000 2.600000 244615384.600000 16.626923 -0.719497 1
AEP American Electric Power Utilities Electric Utilities 58.270000 2.371753 1.068485 11.000000 9.000000 13900000.000000 2052300000.000000 3.130000 421897810.200000 18.456543 -3.022649 1
AFL AFLAC Inc Financials Life & Health Insurance 59.900002 3.027181 1.048295 14.000000 99.000000 -308000000.000000 2533000000.000000 5.880000 430782312.900000 10.187075 -1.883912 1
AIG American International Group, Inc. Financials Property & Casualty Insurance 61.970001 8.358108 1.106965 2.000000 99.000000 -129000000.000000 2196000000.000000 1.690000 1299408284.000000 36.668640 -4.327138 1
AIV Apartment Investment & Mgmt Real Estate REITs 40.029999 7.578608 1.163334 15.000000 47.000000 21818000.000000 248710000.000000 1.520000 163625000.000000 26.335526 -1.269332 1
AIZ Assurant Inc Financials Multi-line Insurance 80.540001 1.897773 1.112604 3.000000 99.000000 -30351000.000000 141555000.000000 2.080000 68055288.460000 38.721154 -4.072615 1
AJG Arthur J. Gallagher & Co. Financials Insurance Brokers 40.939999 -0.606943 1.052050 10.000000 99.000000 166000000.000000 356800000.000000 2.070000 172367149.800000 19.777777 -9.855706 1
AKAM Akamai Technologies Inc Information Technology Internet Software & Services 52.630001 -23.790903 1.384502 10.000000 225.000000 50823000.000000 321406000.000000 1.800000 178558888.900000 29.238889 4.282358 1
ALB Albemarle Corp Materials Specialty Chemicals 56.009998 26.461948 1.974323 10.000000 13.000000 -2276034000.000000 334906000.000000 3.010000 111264451.800000 18.607973 -13.649723 1
ALK Alaska Air Group Inc Industrials Airlines 80.510002 2.066436 1.773431 35.000000 74.000000 -34000000.000000 848000000.000000 6.610000 128290469.000000 12.180031 -1.114658 1
ALL Allstate Corp Financials Property & Casualty Insurance 62.090000 6.592275 1.053266 11.000000 99.000000 -162000000.000000 2171000000.000000 5.120000 424023437.500000 12.126953 -4.327138 1
ALLE Allegion Industrials Building Products 65.919998 13.753230 1.283795 601.000000 45.000000 -90800000.000000 153900000.000000 1.600000 96187500.000000 41.199999 -0.877453 1
AMAT Applied Materials Inc Information Technology Semiconductor Equipment 18.670000 26.834239 1.460030 18.000000 131.000000 1795000000.000000 1377000000.000000 1.130000 1218584071.000000 16.522124 3.857756 1
AME AMETEK Inc Industrials Electrical Components & Equipment 53.590000 2.212474 1.089266 18.000000 37.000000 3390000.000000 590859000.000000 2.460000 240186585.400000 21.784553 -4.490342 1
AMG Affiliated Managers Group Inc Financials Asset Management & Custody Banks 159.759995 -6.611335 2.093065 18.000000 67.000000 13200000.000000 516000000.000000 9.490000 54373024.240000 16.834562 -31.015380 1
AMP Ameriprise Financial Financials Asset Management & Custody Banks 106.419998 -2.420686 1.222260 22.000000 67.000000 -281000000.000000 1562000000.000000 8.600000 181627907.000000 12.374418 -13.398380 1
AMT American Tower Corp A Real Estate Specialized REITs 96.949997 10.233087 1.165804 10.000000 39.000000 7194000.000000 685074000.000000 1.420000 482446478.900000 68.274646 -20.813577 1
AN AutoNation Inc Consumer Discretionary Specialty Stores 59.660000 2.350316 1.480914 19.000000 1.000000 -1300000.000000 442600000.000000 3.930000 112620865.100000 15.180662 -7.970104 1
ANTM Anthem Inc. Health Care Managed Health Care 139.440002 -0.620053 1.511654 11.000000 70.000000 -38200000.000000 2560000000.000000 9.730000 263103802.700000 14.330935 -31.006773 1
AON Aon plc Financials Insurance Brokers 92.209999 3.910301 1.105032 23.000000 99.000000 10000000.000000 1385000000.000000 4.930000 280933062.900000 18.703854 -7.759856 1
APH Amphenol Corp Information Technology Electronic Components 52.230000 2.693667 1.007762 24.000000 175.000000 768300000.000000 763500000.000000 2.470000 309109311.700000 21.145749 8.202923 1
ATVI Activision Blizzard Information Technology Home Entertainment Software 38.709999 23.319529 1.886335 11.000000 70.000000 -3025000000.000000 892000000.000000 1.210000 737190082.600000 31.991735 0.290291 1
AVB AvalonBay Communities, Inc. Real Estate Residential REITs 184.130005 4.857630 1.132875 8.000000 47.000000 -108953000.000000 741733000.000000 5.540000 133886823.100000 33.236463 -3.089477 1
AWK American Water Works Company Inc Utilities Water Utilities 59.750000 8.596874 1.171525 9.000000 4.000000 22000000.000000 476000000.000000 2.660000 178947368.400000 22.462406 -4.895294 1
AXP American Express Co Financials Consumer Finance 69.550003 -6.216290 0.900066 25.000000 99.000000 474000000.000000 5163000000.000000 3.900000 506660363.000000 10.263506 -0.609074 1
BA Boeing Company Industrials Aerospace & Defense 144.589996 10.105078 1.155905 82.000000 24.000000 -431000000.000000 5176000000.000000 7.520000 688297872.300000 19.227393 22.032612 1
BAX Baxter International Inc. Health Care Health Care Equipment 38.150002 16.702365 1.204526 11.000000 128.000000 -712000000.000000 968000000.000000 1.780000 543820224.700000 21.432585 8.637045 1
BBT BB&T Corporation Financials Banks 37.810001 5.940045 1.077678 8.000000 99.000000 1386000000.000000 2084000000.000000 2.590000 804633204.600000 14.598456 -0.852562 1
BCR Bard (C.R.) Inc. Health Care Health Care Equipment 189.440002 1.549182 1.394436 9.000000 82.000000 -9600000.000000 135400000.000000 1.800000 75222222.220000 105.244446 -4.127770 1
BIIB BIOGEN IDEC Inc. Health Care Biotechnology 306.350006 4.917982 1.825994 38.000000 133.000000 148900000.000000 3547000000.000000 15.380000 230624187.300000 19.918726 0.162602 1
BK The Bank of New York Mellon Corp. Financials Banks 41.220001 5.422003 1.201660 8.000000 99.000000 -433000000.000000 3158000000.000000 2.730000 1156776557.000000 15.098901 -3.321298 1
BLL Ball Corp Materials Metal & Glass Containers 72.730003 16.535816 1.386684 22.000000 10.000000 32600000.000000 280900000.000000 2.050000 137024390.200000 35.478050 -3.895657 1
BMY Bristol-Myers Squibb Health Care Health Care Distributors 68.790001 16.081680 1.498872 11.000000 53.000000 -3186000000.000000 1565000000.000000 0.940000 1664893617.000000 73.180852 0.588026 1
BSX Boston Scientific Health Care Health Care Equipment 18.440001 11.757582 1.491764 4.000000 13.000000 -268000000.000000 -239000000.000000 -0.180000 1327777778.000000 31.468962 -3.880921 1
BWA BorgWarner Consumer Discretionary Auto Parts & Equipment 43.230000 3.470563 2.058769 17.000000 25.000000 -220100000.000000 609700000.000000 2.720000 224154411.800000 15.893382 1.044815 1
BXP Boston Properties Real Estate REITs 127.540001 7.203497 1.089469 10.000000 47.000000 -1039361000.000000 583106000.000000 3.790000 153853825.900000 33.651715 -1.269332 1
CAT Caterpillar Inc. Industrials Construction & Farm Machinery & Heavy Trucks 67.959999 3.550209 1.493553 17.000000 25.000000 -881000000.000000 2512000000.000000 3.540000 709604519.800000 19.197740 6.264053 1
CB Chubb Limited Financials Property & Casualty Insurance 116.849998 13.193834 0.944847 10.000000 99.000000 1120000000.000000 2834000000.000000 8.710000 325373134.300000 13.415614 -17.466101 1
CBG CBRE Group Real Estate Real Estate Services 34.580002 8.197757 1.297857 20.000000 12.000000 -200481000.000000 547132000.000000 1.640000 333617073.200000 21.085367 -3.415302 1
CCI Crown Castle International Corp. Real Estate REITs 86.449997 9.569068 0.960191 21.000000 36.000000 3190000.000000 1520992000.000000 4.440000 342565765.800000 19.470720 -10.666679 1
CCL Carnival Corp. Consumer Discretionary Hotels, Resorts & Cruise Lines 54.480000 8.938217 1.347239 7.000000 20.000000 1064000000.000000 1757000000.000000 2.260000 777433628.300000 24.106195 -7.477166 1
CF CF Industries Holdings Inc Materials Fertilizers & Agricultural Chemicals 40.810001 -9.250611 2.368186 16.000000 25.000000 -1710600000.000000 664900000.000000 2.970000 223872053.900000 13.740741 -0.393528 1
CFG Citizens Financial Group Financials Regional Banks 26.190001 10.273688 1.189236 4.000000 99.000000 -191000000.000000 840000000.000000 1.550000 541935483.900000 16.896775 -0.063096 1
CHD Church & Dwight Consumer Staples Household Products 42.439999 1.047615 0.929026 20.000000 38.000000 -93000000.000000 410400000.000000 3.130000 131118210.900000 13.559105 -9.428134 1
CHRW C. H. Robinson Worldwide Industrials Air Freight & Logistics 62.020000 -9.008221 1.185473 44.000000 12.000000 39289000.000000 509699000.000000 3.520000 144800852.300000 17.619318 1.117804 1
CHTR Charter Communications Consumer Discretionary Cable & Satellite 183.100006 3.598507 1.697942 589.000000 0.000000 2000000.000000 -271000000.000000 -2.430000 111522633.700000 20.819876 -76.119077 1
CI CIGNA Corp. Health Care Managed Health Care 146.330002 8.682415 1.588398 17.000000 70.000000 548000000.000000 2094000000.000000 8.170000 256303549.600000 17.910649 -8.805281 1
CINF Cincinnati Financial Financials Property & Casualty Insurance 59.169998 9.777358 0.935812 10.000000 99.000000 -47000000.000000 634000000.000000 3.870000 163824289.400000 15.289405 -4.327138 1
CL Colgate-Palmolive Consumer Staples Household Products 66.620003 4.781379 0.895471 463.000000 27.000000 -119000000.000000 1384000000.000000 1.530000 904575163.400000 43.542486 -0.548324 1
CMA Comerica Inc. Financials Regional Banks 41.830002 1.900129 1.557655 7.000000 99.000000 76000000.000000 521000000.000000 2.930000 177815699.700000 14.276451 -0.063096 1
CME CME Group Inc. Financials Financial Exchanges & Data 90.599998 -2.402245 1.323348 6.000000 99.000000 326500000.000000 1247000000.000000 3.710000 336118598.400000 24.420485 -58.649536 1
CMI Cummins Inc. Industrials Industrial Machinery 88.010002 -18.884791 1.472364 19.000000 48.000000 -590000000.000000 1399000000.000000 7.860000 177989821.900000 11.197201 21.439428 1
CMS CMS Energy Utilities MultiUtilities 36.080002 1.949712 1.037844 14.000000 12.000000 39000000.000000 537000000.000000 1.900000 282631578.900000 18.989475 0.063687 1
CNC Centene Corporation Health Care Managed Health Care 65.809998 21.712591 2.298696 16.000000 70.000000 150000000.000000 355000000.000000 2.990000 118729097.000000 22.010033 -1.305493 1
CNP CenterPoint Energy Utilities MultiUtilities 18.360001 1.436470 1.389867 20.000000 43.000000 -34000000.000000 -692000000.000000 -1.610000 429813664.600000 17.313076 0.516503 1
COF Capital One Financial Financials Consumer Finance 72.180000 -0.619575 1.364592 9.000000 99.000000 781000000.000000 4050000000.000000 7.150000 566433566.400000 10.095105 -0.725643 1
COO The Cooper Companies Health Care Health Care Supplies 134.199997 -9.672215 1.555057 8.000000 3.000000 -8796000.000000 203523000.000000 1.790000 140335195.500000 33.994412 0.855096 1
CSX CSX Corp. Industrials Railroads 25.950001 -4.349421 1.626219 17.000000 74.000000 -41000000.000000 1968000000.000000 2.000000 984000000.000000 12.975001 0.902439 1
CTL CenturyLink Inc Telecommunications Services Integrated Telecommunications Services 25.160000 0.159232 1.522194 6.000000 3.000000 -2000000.000000 878000000.000000 1.580000 555696202.500000 15.924051 -13.383212 1
CTSH Cognizant Technology Solutions Information Technology IT Consulting & Other Services 60.020000 -4.654489 1.338123 17.000000 182.000000 115100000.000000 1623600000.000000 2.670000 608089887.600000 22.479401 7.121644 1
CTXS Citrix Systems Information Technology Internet Software & Services 75.650002 9.021477 1.968864 16.000000 52.000000 108369000.000000 319361000.000000 2.010000 158886069.700000 37.636817 -1.765013 1
CVS CVS Health Consumer Staples Drug Retail 97.769997 1.326561 1.487367 14.000000 11.000000 -22000000.000000 5237000000.000000 4.660000 1123819742.000000 20.980686 -7.019809 1
CVX Chevron Corp. Energy Integrated Oil & Gas 89.959999 12.844955 1.750655 3.000000 43.000000 -1763000000.000000 4587000000.000000 2.460000 1864634146.000000 36.569105 4.763937 1
D Dominion Resources Utilities Electric Utilities 67.639999 -3.988642 0.889931 15.000000 8.000000 289000000.000000 1899000000.000000 3.210000 591588785.000000 21.071651 -7.604945 1
DAL Delta Air Lines Industrials Airlines 50.689999 13.375084 1.444219 42.000000 31.000000 -116000000.000000 4526000000.000000 5.680000 796830985.900000 8.924296 -16.730022 1
DD Du Pont (E.I.) Materials Diversified Chemicals 66.599998 37.489677 1.577881 20.000000 60.000000 -1610000000.000000 1953000000.000000 2.170000 900000000.000000 30.691243 3.252222 1
DE Deere & Co. Industrials Construction & Farm Machinery & Heavy Trucks 76.269997 3.952561 1.551946 29.000000 22.000000 375200000.000000 1940000000.000000 4.030000 532235888.200000 14.842233 6.277287 1
DFS Discover Financial Services Financials Consumer Finance 53.619999 3.653584 1.159897 20.000000 99.000000 2288000000.000000 2297000000.000000 5.140000 446887159.500000 10.431906 -0.375934 1
DGX Quest Diagnostics Health Care Health Care Facilities 71.139999 15.674795 1.381490 15.000000 11.000000 -59000000.000000 709000000.000000 4.920000 144105691.100000 14.459349 -4.552214 1
DHR Danaher Corp. Industrials Industrial Conglomerates 70.416985 8.924595 1.191466 14.000000 13.000000 -2214800000.000000 3357400000.000000 4.810000 698004158.000000 14.639706 -13.759230 1
DIS The Walt Disney Company Consumer Discretionary Broadcasting & Cable TV 105.080002 2.049141 1.188454 19.000000 26.000000 848000000.000000 8382000000.000000 4.950000 1693333333.000000 21.228283 -3.985039 1
DISCA Discovery Communications-A Consumer Discretionary Cable & Satellite 26.680000 2.026769 1.689235 19.000000 25.000000 23000000.000000 1034000000.000000 -2.430000 111522633.700000 20.819876 -76.119077 1
DISCK Discovery Communications-C Consumer Discretionary Cable & Satellite 25.219999 3.572891 1.812144 19.000000 25.000000 23000000.000000 1034000000.000000 -2.430000 111522633.700000 20.819876 -76.119077 1
DLPH Delphi Automotive Consumer Discretionary Auto Parts & Equipment 85.730003 12.109326 1.440884 64.000000 14.000000 -325000000.000000 1450000000.000000 5.080000 285433070.900000 16.875985 -0.662152 1
DLR Digital Realty Trust Real Estate Specialized REITs 75.620003 15.573900 1.070406 7.000000 39.000000 22239000.000000 296689000.000000 1.560000 190185256.400000 48.474361 -7.489313 1
DNB Dun & Bradstreet Industrials Research & Consulting Services 103.930000 -1.188439 1.337924 15.000000 38.000000 46300000.000000 168800000.000000 4.680000 36068376.070000 22.207265 -11.877441 1
DOV Dover Corp. Industrials Industrial Machinery 61.310001 6.979585 1.507569 24.000000 26.000000 -319396000.000000 869829000.000000 5.520000 157577717.400000 11.106884 -2.293440 1
DPS Dr Pepper Snapple Group Consumer Staples Soft Drinks 93.199997 18.049399 1.150797 35.000000 58.000000 683000000.000000 764000000.000000 4.000000 191000000.000000 23.299999 -12.717277 1
DUK Duke Energy Utilities Electric Utilities 71.389999 -0.833448 1.096727 7.000000 8.000000 -1179000000.000000 2816000000.000000 4.050000 695308642.000000 17.627160 -4.426811 1
DVA DaVita Inc. Health Care Health Care Facilities 69.709999 -3.622291 1.211643 6.000000 79.000000 533875000.000000 269732000.000000 1.270000 212387401.600000 54.889763 1.962527 1
ECL Ecolab Inc. Materials Specialty Chemicals 114.379997 3.783684 1.078516 15.000000 2.000000 -116800000.000000 1002100000.000000 3.380000 296479289.900000 33.840236 -14.928867 1
ED Consolidated Edison Utilities Electric Utilities 64.269997 -3.974306 1.068002 9.000000 20.000000 249000000.000000 1193000000.000000 4.070000 293120393.100000 15.791154 -3.022649 1
EFX Equifax Inc. Industrials Research & Consulting Services 111.370003 14.531063 1.081040 19.000000 15.000000 -35000000.000000 429100000.000000 3.610000 118864265.900000 30.850416 -8.116821 1
EIX Edison Int'l Utilities Electric Utilities 59.209999 -6.135071 0.927260 10.000000 3.000000 29000000.000000 1117000000.000000 3.130000 356869009.600000 18.916933 -6.369284 1
EMN Eastman Chemical Materials Diversified Chemicals 67.510002 3.654238 1.404508 22.000000 14.000000 79000000.000000 848000000.000000 5.710000 148511383.500000 11.823118 -12.308821 1
EQR Equity Residential Real Estate REITs 81.589996 8.037605 1.056186 8.000000 47.000000 2196000.000000 870120000.000000 2.370000 367139240.500000 34.426159 -1.269332 1
ES Eversource Energy Utilities MultiUtilities 51.070000 0.709921 1.232829 8.000000 1.000000 -14756000.000000 878485000.000000 2.770000 317142599.300000 18.436823 -1.169833 1
ESS Essex Property Trust, Inc. Real Estate Residential REITs 239.410004 6.765073 1.118425 4.000000 47.000000 4073000.000000 232120000.000000 3.500000 66320000.000000 68.402858 -3.089477 1
ETFC E*Trade Financials Investment Banking & Brokerage 29.639999 12.656785 1.452048 5.000000 99.000000 450000000.000000 268000000.000000 0.920000 291304347.800000 32.217390 -0.597313 1
ETN Eaton Corporation Industrials Industrial Conglomerates 52.040001 1.166411 1.521430 13.000000 10.000000 -513000000.000000 1979000000.000000 4.250000 465647058.800000 12.244706 -8.639591 1
ETR Entergy Corp. Utilities Electric Utilities 68.360001 4.910983 1.217401 2.000000 44.000000 -71065000.000000 -156734000.000000 -0.990000 158317171.700000 18.456543 6.174024 1
EXC Exelon Corp. Utilities MultiUtilities 27.770000 -6.403775 1.351595 9.000000 74.000000 4624000000.000000 2269000000.000000 2.685000 299887089.100000 17.313076 -1.715880 1
EXPD Expeditors Int'l Industrials Air Freight & Logistics 45.099998 -4.449159 1.062553 27.000000 94.000000 -119311000.000000 457223000.000000 2.420000 188935124.000000 18.636363 5.991459 1
EXPE Expedia Inc. Consumer Discretionary Internet & Direct Marketing Retail 124.300003 4.894517 1.578747 16.000000 29.000000 273599000.000000 764465000.000000 5.870000 130232538.300000 21.175469 -44.103494 1
EXR Extra Space Storage Real Estate Specialized REITs 88.209999 13.922251 1.186059 19.000000 39.000000 28136000.000000 394950000.000000 1.580000 249968354.400000 55.829113 -14.151445 1
FAST Fastenal Co Industrials Building Products 40.820000 10.984234 1.411396 29.000000 35.000000 14523000.000000 516361000.000000 1.770000 291729378.500000 23.062147 4.427425 1
FBHS Fortune Brands Home & Security Industrials Building Products 55.500000 16.817517 1.348297 13.000000 31.000000 46600000.000000 315000000.000000 1.970000 159898477.200000 28.172589 -2.100708 1
FE FirstEnergy Corp Utilities Electric Utilities 31.730000 1.179844 1.238785 5.000000 2.000000 46000000.000000 578000000.000000 1.370000 421897810.200000 23.160584 -6.072561 1
FIS Fidelity National Information Services Information Technology Internet Software & Services 60.599998 -10.553508 1.148295 7.000000 29.000000 194800000.000000 650800000.000000 2.220000 293153153.200000 27.297296 -19.086610 1
FISV Fiserv Inc Information Technology Internet Software & Services 91.459999 5.235295 0.904487 27.000000 18.000000 -19000000.000000 712000000.000000 3.040000 234210526.300000 30.085526 -7.975730 1
FLIR FLIR Systems Information Technology Electronic Equipment & Instruments 28.070000 0.214209 1.761193 15.000000 81.000000 -58589000.000000 241686000.000000 1.730000 139702890.200000 16.225434 4.014713 1
FLR Fluor Corp. Industrials Diversified Commercial Services 47.220001 10.819056 1.774454 14.000000 73.000000 -43239000.000000 412512000.000000 2.850000 144741052.600000 16.568421 14.992623 1
FLS Flowserve Corporation Industrials Industrial Machinery 42.080002 2.210357 1.781661 16.000000 27.000000 -83906000.000000 267669000.000000 2.010000 133168656.700000 20.935324 6.746760 1
FMC FMC Corporation Materials Diversified Chemicals 39.130001 15.088238 2.175738 26.000000 5.000000 -30900000.000000 489000000.000000 3.660000 133606557.400000 10.691257 5.101546 1
FRT Federal Realty Investment Trust Real Estate Retail REITs 146.100006 6.806063 1.239858 13.000000 47.000000 -26905000.000000 210219000.000000 3.040000 69150986.840000 48.059213 -3.973395 1
GD General Dynamics Industrials Aerospace & Defense 137.360001 -0.463767 0.939544 28.000000 22.000000 -1603000000.000000 2965000000.000000 9.230000 321235102.900000 14.881907 4.242998 1
GGP General Growth Properties Inc. Real Estate Retail REITs 27.209999 4.212937 1.390342 17.000000 47.000000 -15576000.000000 1374561000.000000 3.040000 158299350.600000 47.366973 -3.973395 1
GLW Corning Inc. Information Technology Electronic Components 18.280001 6.588927 1.578483 7.000000 163.000000 -809000000.000000 1339000000.000000 1.020000 1312745098.000000 17.921570 3.617610 1
GM General Motors Consumer Discretionary Automobile Manufacturers 34.009998 12.281271 1.344514 24.000000 33.000000 -3857000000.000000 9687000000.000000 6.110000 1585433715.000000 5.566284 -4.892037 1
GPC Genuine Parts Consumer Discretionary Specialty Stores 85.889999 4.033432 1.177027 22.000000 5.000000 73901000.000000 705672000.000000 4.650000 151757419.400000 18.470968 7.205242 1
GRMN Garmin Ltd. Consumer Discretionary Consumer Electronics 37.169998 3.393594 1.665475 14.000000 121.000000 -363198000.000000 456227000.000000 2.390000 190889958.200000 15.552300 5.760057 1
GT Goodyear Tire & Rubber Consumer Discretionary Tires & Rubber 32.669998 10.446241 1.522778 8.000000 30.000000 -685000000.000000 307000000.000000 1.140000 269298245.600000 28.657893 3.835896 1
GWW Grainger (W.W.) Inc. Industrials Industrial Materials 202.589996 -5.336199 1.348597 34.000000 16.000000 63492000.000000 768996000.000000 11.690000 65782378.100000 17.330196 12.112879 1
HAS Hasbro Inc. Consumer Discretionary Leisure Products 67.360001 -7.076834 1.583355 27.000000 92.000000 83583000.000000 451838000.000000 3.610000 125162880.900000 18.659280 12.145326 1
HBAN Huntington Bancshares Financials Banks 11.060000 4.143126 1.337793 11.000000 99.000000 -373409000.000000 692957000.000000 0.820000 845069512.200000 13.487805 -0.065057 1
HCA HCA Holdings Health Care Health Care Facilities 67.629997 -12.532337 1.914907 28.000000 13.000000 175000000.000000 2129000000.000000 5.140000 414202334.600000 13.157587 -7.279051 1
HCN Welltower Inc. Real Estate REITs 68.029999 0.044116 1.341731 6.000000 47.000000 -112818000.000000 849073000.000000 2.350000 361307659.600000 28.948936 -3.738047 1
HCP HCP Inc. Real Estate REITs 34.826959 2.218658 1.282286 6.000000 47.000000 162690000.000000 -559235000.000000 -1.210000 462177686.000000 33.651715 -1.269332 1
HIG Hartford Financial Svc.Gp. Financials Property & Casualty Insurance 43.459999 -5.005467 1.147332 10.000000 99.000000 49000000.000000 1682000000.000000 4.050000 415308642.000000 10.730864 -4.327138 1
HOG Harley-Davidson Consumer Discretionary Motorcycle Manufacturers 45.389999 -17.247036 1.560372 41.000000 31.000000 -184471000.000000 752207000.000000 3.710000 202751212.900000 12.234501 6.069389 1
HON Honeywell Int'l Inc. Industrials Industrial Conglomerates 103.570000 9.320247 1.103449 26.000000 41.000000 -1504000000.000000 4768000000.000000 6.110000 780360065.500000 16.950900 -3.709826 1
HPQ HP Inc. Information Technology Computer Hardware 11.840000 2.161759 2.373359 16.000000 18.000000 2300000000.000000 4554000000.000000 1.800000 513987730.100000 25.309524 3.954975 1
HRL Hormel Foods Corp. Consumer Staples Packaged Foods & Meats 39.540001 24.496225 1.078455 17.000000 29.000000 13065000.000000 686088000.000000 3.280000 199237804.900000 24.070121 -1.980483 1
HSIC Henry Schein Health Care Health Care Distributors 158.190002 18.317132 1.013922 17.000000 3.000000 -17388000.000000 479058000.000000 5.780000 82882006.920000 27.368512 5.925677 1
HST Host Hotels & Resorts Real Estate REITs 15.340000 -3.217666 1.594628 8.000000 47.000000 -445000000.000000 558000000.000000 0.220000 2536363636.000000 69.727273 -0.113548 1
HSY The Hershey Company Consumer Staples Packaged Foods & Meats 89.269997 -3.261814 1.188383 51.000000 16.000000 -28325000.000000 512951000.000000 3.280000 199237804.900000 24.070121 -1.980483 1
HUM Humana Inc. Health Care Managed Health Care 178.509995 -0.145443 1.615206 12.000000 70.000000 636000000.000000 1276000000.000000 8.540000 149414519.900000 20.902810 -8.805281 1
IBM International Business Machines Information Technology IT Consulting & Other Services 137.619995 -5.292136 1.082881 92.000000 24.000000 -790000000.000000 13190000000.000000 13.480000 978486646.900000 10.209198 4.852391 1
IDXX IDEXX Laboratories Health Care Health Care Equipment 72.919998 -1.565880 1.469586 228.000000 40.000000 -193542000.000000 192078000.000000 2.070000 92791304.350000 35.227052 -0.981083 1
IFF Intl Flavors & Fragrances Materials Specialty Chemicals 119.639999 14.961083 1.152855 26.000000 25.000000 -296585000.000000 419247000.000000 5.190000 80779768.790000 23.052023 5.047700 1
IP International Paper Materials Paper Packaging 37.700001 -0.026513 1.301630 24.000000 27.000000 -831000000.000000 938000000.000000 2.250000 416888888.900000 16.755556 6.123934 1
IPG Interpublic Group Consumer Discretionary Advertising 23.280001 21.821035 1.139799 23.000000 20.000000 -157700000.000000 454600000.000000 1.110000 409549549.600000 20.972974 0.265658 1
IRM Iron Mountain Incorporated Real Estate REITs 27.010000 -13.067267 1.301382 24.000000 15.000000 2448000.000000 123241000.000000 0.580000 212484482.800000 46.568966 -2.763651 1
ITW Illinois Tool Works Industrials Industrial Machinery 92.680000 12.776831 1.142869 36.000000 130.000000 -900000000.000000 1899000000.000000 5.160000 368023255.800000 17.961240 7.586477 1
IVZ Invesco Ltd. Financials Asset Management & Custody Banks 33.480000 7.067477 1.580839 12.000000 67.000000 412000000.000000 968100000.000000 2.260000 428362831.900000 14.814159 4.218620 1
JBHT J. B. Hunt Transport Services Industrials Trucking 73.360001 2.961405 1.218373 33.000000 1.000000 -395000.000000 427235000.000000 3.690000 115781842.800000 19.880759 2.823845 1
JEC Jacobs Engineering Group Industrials Industrial Conglomerates 41.950001 11.539484 1.732990 7.000000 23.000000 -271788000.000000 302971000.000000 2.420000 125194628.100000 17.334711 6.294943 1
JNPR Juniper Networks Information Technology Networking Equipment 27.600000 7.351229 1.841767 14.000000 108.000000 -218700000.000000 633700000.000000 1.620000 391172839.500000 17.037037 2.752236 1
KIM Kimco Realty Real Estate REITs 26.459999 8.709938 1.224688 18.000000 47.000000 2212000.000000 894115000.000000 2.010000 444833333.300000 13.164179 -1.269332 1
KMB Kimberly-Clark Consumer Staples Household Products 127.300003 17.511309 0.870405 582.000000 10.000000 -170000000.000000 1013000000.000000 2.780000 364388489.200000 45.791368 -2.533011 1
KSU Kansas City Southern Industrials Railroads 74.669998 -18.438017 2.071639 12.000000 18.000000 -211400000.000000 483500000.000000 4.410000 109637188.200000 16.931972 -2.012091 1
LEG Leggett & Platt Industrials Industrial Conglomerates 42.020000 1.965545 1.204037 30.000000 36.000000 -79600000.000000 329200000.000000 2.310000 142510822.500000 18.190476 2.931005 1
LEN Lennar Corp. Consumer Discretionary Homebuilding 48.910000 1.705136 1.569167 14.000000 25.000000 -123369000.000000 802894000.000000 3.870000 207466149.900000 12.638243 -0.307832 1
LH Laboratory Corp. of America Holding Health Care Health Care Facilities 123.639999 14.174899 1.603130 9.000000 42.000000 136400000.000000 436900000.000000 5.030000 178246546.300000 15.900937 -1.294844 1
LKQ LKQ Corporation Consumer Discretionary Distributors 29.629999 4.441304 1.427237 14.000000 12.000000 -27208000.000000 423223000.000000 3.030000 213598256.500000 20.819876 -0.857290 1
LLL L-3 Communications Holdings Industrials Industrial Conglomerates 119.510002 14.539013 1.513434 6.000000 7.000000 -235000000.000000 -240000000.000000 -2.970000 80808080.810000 17.334711 14.280750 1
LLY Lilly (Eli) & Co. Health Care Pharmaceuticals 84.260002 0.789478 1.440622 17.000000 54.000000 -205200000.000000 2408400000.000000 2.270000 1060969163.000000 37.118944 -0.651103 1
LMT Lockheed Martin Corp. Industrials Aerospace & Defense 217.149994 5.254227 0.903098 116.000000 8.000000 -356000000.000000 3605000000.000000 11.620000 310240963.900000 18.687607 -10.852854 1
LNT Alliant Energy Corp Utilities Electric Utilities 31.225001 6.642759 1.115842 10.000000 0.000000 -51100000.000000 388400000.000000 3.360000 115595238.100000 9.293155 -4.606591 1
LUK Leucadia National Corp. Financials Multi-Sector Holdings 17.389999 -14.292764 1.554235 2.000000 81.000000 -638127000.000000 252111000.000000 0.740000 340690540.500000 23.499999 19.821416 1
LUV Southwest Airlines Industrials Airlines 43.060001 13.855106 1.536290 30.000000 41.000000 301000000.000000 2181000000.000000 3.300000 660909090.900000 13.048485 -5.117194 1
LVLT Level 3 Communications Telecommunications Services Alternative Carriers 54.360001 24.707504 1.457013 34.000000 61.000000 274000000.000000 3433000000.000000 9.710000 353553038.100000 5.598352 -2.245773 1
LYB LyondellBasell Materials Diversified Chemicals 86.900002 2.573183 1.609745 68.000000 46.000000 -107000000.000000 4476000000.000000 9.620000 465280665.300000 9.033264 10.316354 1
MA Mastercard Inc. Information Technology Internet Software & Services 97.360001 7.496965 1.095876 63.000000 130.000000 610000000.000000 3808000000.000000 3.360000 1133333333.000000 28.976191 3.451765 1
MAA Mid-America Apartments Real Estate Residential REITs 90.809998 10.622490 1.177776 12.000000 47.000000 10906000.000000 350745000.000000 4.410000 79534013.610000 20.591836 -3.089477 1
MAC Macerich Real Estate Retail REITs 80.690002 4.183351 1.169328 10.000000 47.000000 1603000.000000 487562000.000000 3.080000 158299350.600000 26.198053 -3.973395 1
MAR Marriott Int'l. Consumer Discretionary Hotels, Resorts & Cruise Lines 67.040001 -1.973970 1.642450 24.000000 3.000000 -8000000.000000 859000000.000000 3.220000 266770186.300000 20.819876 -12.370198 1
MAS Masco Corp. Industrials Building Products 28.299999 11.637077 1.428359 263.000000 61.000000 85000000.000000 355000000.000000 1.030000 344660194.200000 27.475727 2.219577 1
MAT Mattel Inc. Consumer Discretionary Leisure Products 27.170000 30.625006 1.921708 14.000000 54.000000 -78836000.000000 369416000.000000 1.080000 342051851.900000 25.157407 4.535251 1
MCO Moody's Corp Financials Diversified Financial Services 100.339996 2.345976 1.268800 167.000000 183.000000 537900000.000000 941300000.000000 4.700000 200276595.700000 21.348935 8.615585 1
MDLZ Mondelez International Consumer Staples Packaged Foods & Meats 44.840000 6.079962 1.321548 26.000000 17.000000 239000000.000000 7267000000.000000 4.490000 1618485523.000000 9.986637 -12.809506 1
MET MetLife Inc. Financials Life & Health Insurance 48.209999 1.366690 1.138650 8.000000 99.000000 1944000000.000000 5310000000.000000 4.610000 1151843818.000000 10.457700 -1.883912 1
MHK Mohawk Industries Consumer Discretionary Home Furnishings 189.389999 3.514425 1.492478 13.000000 3.000000 -16185000.000000 615302000.000000 2.590000 237568339.800000 73.123552 -3.980316 1
MJN Mead Johnson Consumer Staples Packaged Foods & Meats 78.949997 12.081196 1.718403 103.000000 136.000000 403700000.000000 653500000.000000 3.280000 199237804.900000 24.070121 6.495755 1
MKC McCormick & Co. Consumer Staples Packaged Foods & Meats 85.559998 6.976738 1.032221 24.000000 9.000000 35300000.000000 401600000.000000 3.140000 127898089.200000 27.248407 -1.980483 1
MLM Martin Marietta Materials Materials Construction Materials 136.580002 -10.866015 2.164150 7.000000 46.000000 59758000.000000 288792000.000000 4.310000 67005104.410000 31.689096 3.050887 1
MMC Marsh & McLennan Financials Insurance Brokers 55.450001 6.022948 1.034162 25.000000 99.000000 -584000000.000000 1599000000.000000 3.010000 531229235.900000 18.421927 -1.950194 1
MMM 3M Company Industrials Industrial Conglomerates 150.639999 5.927847 0.982698 42.000000 27.000000 -99000000.000000 4833000000.000000 7.720000 626036269.400000 19.512953 2.023844 1
MO Altria Group Inc Consumer Staples Tobacco 58.209999 6.885788 0.959008 182.000000 33.000000 -952000000.000000 5241000000.000000 2.670000 1962921348.000000 21.801498 -6.632971 1
MPC Marathon Petroleum Energy Oil & Gas Refining & Marketing & Transportation 51.840000 11.507846 1.989371 22.000000 18.000000 -367000000.000000 2852000000.000000 5.290000 539130434.800000 9.799622 5.798226 1
MRK Merck & Co. Health Care Pharmaceuticals 52.820000 7.031413 1.278460 10.000000 70.000000 1083000000.000000 4442000000.000000 1.580000 2811392405.000000 33.430380 -4.282931 1
MTB M&T Bank Corp. Financials Banks 121.180000 -0.361785 1.380390 7.000000 99.000000 -5317000.000000 1079667000.000000 7.220000 149538365.700000 16.783934 -0.938007 1
MTD Mettler Toledo Health Care Life Sciences Tools & Services 339.130005 18.942905 1.115376 61.000000 18.000000 13624000.000000 352820000.000000 12.750000 27672156.860000 26.598432 4.403994 1
MYL Mylan N.V. Health Care Pharmaceuticals 54.070000 33.177346 2.299304 9.000000 30.000000 1010500000.000000 847600000.000000 1.580000 1633015873.000000 33.430380 -4.213309 1
NAVI Navient Financials Consumer Finance 11.450000 1.868327 2.230827 25.000000 99.000000 151000000.000000 997000000.000000 2.660000 374812030.100000 4.304511 -1.880943 1
NDAQ NASDAQ OMX Group Financials Diversified Financial Services 58.169998 8.810324 1.563258 8.000000 117.000000 -126000000.000000 428000000.000000 2.560000 167187500.000000 22.722655 -11.717383 1
NEE NextEra Energy Utilities MultiUtilities 103.889999 6.237855 1.023375 12.000000 6.000000 -6000000.000000 2752000000.000000 6.110000 450409165.300000 17.003273 -7.353314 1
NLSN Nielsen Holdings Industrials Research & Consulting Services 46.599998 4.931317 1.198493 13.000000 21.000000 84000000.000000 570000000.000000 1.550000 367741935.500000 30.064515 -12.375526 1
NSC Norfolk Southern Corp. Industrials Railroads 84.589996 9.529966 2.168814 13.000000 49.000000 128000000.000000 1556000000.000000 5.130000 303313840.200000 16.489278 0.926433 1
NTRS Northern Trust Corp. Financials Asset Management & Custody Banks 72.089996 5.796884 1.281566 11.000000 67.000000 3394000000.000000 973800000.000000 4.030000 241637717.100000 17.888336 -13.398380 1
NUE Nucor Corp. Materials Steel 40.299999 6.585554 1.460619 5.000000 147.000000 915325000.000000 357659000.000000 1.110000 322215315.300000 36.306305 11.168107 1
NWL Newell Brands Consumer Discretionary Housewares & Specialties 44.080002 9.980039 1.641300 19.000000 14.000000 75400000.000000 350000000.000000 1.300000 269230769.200000 33.907694 -2.075543 1
O Realty Income Corporation Real Estate Retail REITs 51.630001 8.420836 1.104581 4.000000 47.000000 36442000.000000 283766000.000000 1.090000 260335779.800000 47.366973 -3.973395 1
OMC Omnicom Group Consumer Discretionary Advertising 75.660004 14.810321 1.066369 45.000000 18.000000 217100000.000000 1093900000.000000 4.430000 246930022.600000 17.079008 -10.464098 1
ORLY O'Reilly Automotive Consumer Discretionary Specialty Stores 253.419998 0.964143 1.089370 47.000000 4.000000 -134259000.000000 931216000.000000 9.320000 99915879.830000 27.190987 -0.364026 1
PBCT People's United Financial Financials Thrifts & Mortgage Finance 16.150000 3.128991 1.132813 5.000000 99.000000 -298400000.000000 260100000.000000 0.860000 302441860.500000 18.779070 -0.426859 1
PBI Pitney-Bowes Industrials Technology, Hardware, Software and Supplies 20.650000 3.821021 1.259611 228.000000 34.000000 -403561000.000000 407943000.000000 2.040000 199972058.800000 10.122549 -0.733207 1
PCAR PACCAR Inc. Industrials Construction & Farm Machinery & Heavy Trucks 47.400002 -9.317004 1.439564 23.000000 110.000000 278800000.000000 1604000000.000000 4.520000 354867256.600000 10.486726 6.290521 1
PCG PG&E Corp. Utilities MultiUtilities 53.189999 0.510206 1.039803 5.000000 6.000000 -28000000.000000 888000000.000000 1.810000 490607734.800000 29.386740 -1.121059 1
PEG Public Serv. Enterprise Inc. Utilities Electric Utilities 38.689999 -8.230553 1.180661 13.000000 11.000000 -8000000.000000 1679000000.000000 3.320000 505722891.600000 11.653614 -0.361858 1
PEP PepsiCo Inc. Consumer Staples Soft Drinks 99.919998 6.072188 0.805357 45.000000 68.000000 2962000000.000000 5452000000.000000 3.710000 1469541779.000000 26.932614 -5.190734 1
PFG Principal Financial Group Financials Diversified Financial Services 44.980000 -5.305263 1.528985 13.000000 117.000000 700900000.000000 1234000000.000000 4.110000 300243309.000000 10.944039 -4.526995 1
PG Procter & Gamble Consumer Staples Personal Products 79.410004 10.660538 0.806056 17.000000 129.000000 160383000.000000 636056000.000000 3.280000 491391569.000000 24.070121 -2.256747 1
PGR Progressive Corp. Financials Property & Casualty Insurance 31.799999 3.515625 1.086898 17.000000 99.000000 116000000.000000 1267600000.000000 2.160000 586851851.900000 14.722222 -0.843313 1
PHM Pulte Homes Inc. Consumer Discretionary Homebuilding 17.820000 -5.564393 1.694751 10.000000 25.000000 -533785000.000000 494090000.000000 1.380000 358036231.900000 12.913043 -0.307832 1
PM Philip Morris International Consumer Staples Tobacco 87.910004 10.328820 0.861453 52.000000 22.000000 1735000000.000000 6873000000.000000 4.420000 1554977376.000000 19.889141 -1.418027 1
PNC PNC Financial Services Financials Banks 95.309998 6.993709 1.120534 9.000000 99.000000 -295000000.000000 4106000000.000000 7.520000 546010638.300000 12.674202 -0.694126 1
PNR Pentair Ltd. Industrials Industrial Machinery 49.529999 -3.034462 1.875910 2.000000 8.000000 15900000.000000 -76400000.000000 -0.420000 181904761.900000 14.579221 -6.574869 1
PNW Pinnacle West Capital Utilities MultiUtilities 64.480003 0.498752 1.143421 10.000000 3.000000 31884000.000000 437257000.000000 3.940000 110978934.000000 16.365483 -6.089228 1
PPG PPG Industries Materials Diversified Chemicals 98.820000 19.160738 1.533003 28.000000 31.000000 625000000.000000 1406000000.000000 5.180000 271428571.400000 19.077220 -0.593158 1
PPL PPL Corp. Utilities Electric Utilities 34.130001 3.424245 1.109059 7.000000 22.000000 -563000000.000000 682000000.000000 1.010000 675247524.800000 33.792080 -2.827111 1
PRU Prudential Financial Financials Diversified Financial Services 81.410004 6.585503 1.227467 13.000000 117.000000 2694000000.000000 5642000000.000000 12.370000 456103476.200000 6.581245 -4.178927 1
PSX Phillips 66 Energy Oil & Gas Refining & Marketing & Transportation 81.800003 5.371643 1.379589 18.000000 41.000000 -2133000000.000000 4227000000.000000 7.780000 543316195.400000 10.514139 7.029056 1
PX Praxair Inc. Materials Industrial Gases 102.400002 0.293834 1.131240 35.000000 8.000000 21000000.000000 1547000000.000000 5.390000 287012987.000000 18.998145 0.574887 1
PYPL PayPal Information Technology Data Processing & Outsourced Services 36.200001 17.456201 1.925754 9.000000 25.000000 -808000000.000000 1228000000.000000 1.000000 1228000000.000000 36.200001 5.434039 1
R Ryder System Industrials Industrial Conglomerates 56.830002 -23.244191 1.945966 15.000000 4.000000 10853000.000000 304768000.000000 5.750000 53003130.430000 9.883479 -12.020894 1
RCL Royal Caribbean Cruises Ltd Consumer Discretionary Hotels, Resorts & Cruise Lines 101.209999 13.425973 1.556512 8.000000 9.000000 -67676000.000000 665783000.000000 3.030000 219730363.000000 33.402640 -15.727481 1
RHI Robert Half International Industrials Human Resource & Employment Services 47.139999 -7.659158 1.142370 36.000000 34.000000 -62542000.000000 357796000.000000 2.720000 131542647.100000 17.330882 4.089472 1
ROP Roper Industries Industrials Industrial Conglomerates 189.789993 20.432767 1.058807 13.000000 108.000000 168081000.000000 696067000.000000 6.920000 100587716.800000 27.426300 -16.215469 1
RSG Republic Services Inc Industrials Industrial Conglomerates 43.990002 6.745943 0.839821 10.000000 2.000000 -42800000.000000 749900000.000000 2.140000 350420560.700000 20.556076 -2.428225 1
SCG SCANA Corp Utilities MultiUtilities 60.490002 7.232764 1.266240 14.000000 9.000000 39000000.000000 746000000.000000 5.220000 142911877.400000 11.588123 -4.016461 1
SCHW Charles Schwab Corporation Financials Investment Banking & Brokerage 32.930000 15.462833 1.456940 11.000000 99.000000 615000000.000000 1447000000.000000 1.040000 1391346154.000000 31.663462 -0.130090 1
SEE Sealed Air Materials Paper Packaging 44.599998 -5.146750 1.580117 43.000000 19.000000 73000000.000000 225400000.000000 1.630000 138282208.600000 27.361962 -2.716908 1
SHW Sherwin-Williams Materials Specialty Chemicals 259.600006 16.537983 1.426488 121.000000 10.000000 165012000.000000 1053849000.000000 11.380000 92605360.280000 22.811951 2.825366 1
SLG SL Green Realty Real Estate Office REITs 112.980003 4.004424 1.091967 4.000000 47.000000 -26010000.000000 284084000.000000 1.020000 278513725.500000 110.764709 -3.089477 1
SNI Scripps Networks Interactive Inc. Consumer Discretionary Broadcasting & Cable TV 55.209999 12.238260 1.773865 40.000000 23.000000 -654720000.000000 606828000.000000 4.680000 129664102.600000 11.797008 -7.961579 1
SO Southern Co. Utilities Electric Utilities 46.790001 4.372070 0.895059 11.000000 15.000000 694000000.000000 2421000000.000000 2.600000 931153846.200000 17.996154 -2.795456 1
SPG Simon Property Group Inc Real Estate REITs 194.440002 5.284822 1.135546 48.000000 47.000000 88852000.000000 2139375000.000000 5.880000 363839285.700000 33.068028 -1.269332 1
SPGI S&P Global, Inc. Financials Diversified Financial Services 98.580002 14.044424 1.080858 596.000000 51.000000 -1016000000.000000 1156000000.000000 4.260000 271361502.300000 23.140846 -4.178927 1
SRCL Stericycle Inc Industrials Industrial Conglomerates 120.599998 -13.906342 1.203816 10.000000 9.000000 33398000.000000 267046000.000000 3.020000 88425827.810000 39.933774 -18.864194 1
SRE Sempra Energy Utilities MultiUtilities 94.010002 -2.791849 1.126448 11.000000 9.000000 -167000000.000000 1350000000.000000 5.430000 248618784.500000 17.313076 -8.547222 1
STI SunTrust Banks Financials Banks 42.840000 11.970732 1.437938 8.000000 99.000000 -2630000000.000000 1933000000.000000 3.620000 533977900.600000 11.834254 -2.481376 1
STT State Street Corp. Financials Diversified Financial Services 66.360001 -0.866449 1.444644 9.000000 117.000000 -648000000.000000 1980000000.000000 4.530000 437086092.700000 14.649007 -4.044970 1
SYF Synchrony Financial Financials Consumer Finance 30.410000 -2.874478 1.835028 18.000000 99.000000 497000000.000000 2214000000.000000 2.660000 832330827.100000 11.432331 -0.842213 1
SYK Stryker Corp. Health Care Health Care Equipment 92.940002 -1.650792 1.138163 17.000000 116.000000 1584000000.000000 1439000000.000000 3.820000 376701570.700000 24.329843 7.026782 1
TAP Molson Coors Brewing Company Consumer Staples Brewers 93.919998 13.129368 1.217803 5.000000 35.000000 -150300000.000000 359500000.000000 1.940000 185309278.400000 48.412370 -25.385129 1
TGNA Tegna, Inc. Consumer Discretionary Publishing 25.520000 13.624226 1.797269 21.000000 21.000000 10716000.000000 459522000.000000 2.040000 225255882.400000 12.509804 -12.726553 1
TMK Torchmark Corp. Financials Life & Health Insurance 57.160000 1.168142 1.022968 13.000000 99.000000 -4636000.000000 527100000.000000 4.210000 125201900.200000 13.577197 -1.883912 1
TMO Thermo Fisher Scientific Health Care Health Care Equipment 141.850006 15.607180 1.247751 9.000000 11.000000 -891400000.000000 1975400000.000000 4.960000 398266129.000000 28.598792 -28.032512 1
TRV The Travelers Companies Inc. Financials Property & Casualty Insurance 112.860001 13.029548 0.959365 15.000000 99.000000 6000000.000000 3439000000.000000 10.990000 312920837.100000 10.269336 -0.891599 1
TSCO Tractor Supply Company Consumer Discretionary Specialty Retail 85.500000 1.303315 1.431109 29.000000 10.000000 12679000.000000 410395000.000000 3.030000 135443894.400000 28.217822 6.010954 1
TSN Tyson Foods Consumer Staples Packaged Foods & Meats 53.330002 23.249369 1.586719 13.000000 19.000000 250000000.000000 1220000000.000000 3.280000 199237804.900000 24.070121 -1.980483 1
TSO Tesoro Petroleum Co. Energy Oil & Gas Refining & Marketing & Transportation 105.370003 8.584091 1.854132 30.000000 37.000000 -58000000.000000 1540000000.000000 12.500000 123200000.000000 8.429600 4.594156 1
TSS Total System Services Information Technology Internet Software & Services 49.799999 9.234479 1.579248 20.000000 115.000000 100145000.000000 369041000.000000 1.980000 186384343.400000 25.151515 -2.347391 1
TXN Texas Instruments Information Technology Semiconductors 54.810001 9.971912 1.263479 30.000000 126.000000 -199000000.000000 2986000000.000000 2.860000 1044055944.000000 19.164336 2.768051 1
UAA Under Armour Consumer Discretionary Apparel, Accessories & Luxury Goods 80.610001 -16.948277 1.758824 14.000000 27.000000 -463323000.000000 232573000.000000 3.030000 213598256.500000 20.819876 -0.857290 1
UAL United Continental Holdings Industrials Airlines 57.299999 8.215294 1.747606 82.000000 42.000000 1004000000.000000 7340000000.000000 19.520000 376024590.200000 2.935451 -23.195292 1
UDR UDR Inc Real Estate Residential REITs 37.570000 8.583821 1.157906 12.000000 47.000000 -8482000.000000 340383000.000000 1.300000 261833076.900000 28.900000 -3.089477 1
UHS Universal Health Services, Inc. Health Care Health Care Facilities 119.489998 -5.136552 2.048697 16.000000 6.000000 29159000.000000 680528000.000000 6.890000 98770391.870000 17.342525 6.255903 1
UNH United Health Group Inc. Health Care Managed Health Care 117.639999 1.466273 1.482349 17.000000 70.000000 3428000000.000000 5813000000.000000 6.100000 952950819.700000 19.285246 -8.805281 1
UNM Unum Group Financials Diversified Financial Services 33.290001 3.804181 1.102848 10.000000 117.000000 10400000.000000 867100000.000000 3.510000 247037037.000000 9.484331 -4.178927 1
UNP Union Pacific Industrials Railroads 78.199997 -12.371135 1.430297 23.000000 43.000000 -195000000.000000 4772000000.000000 5.510000 866061706.000000 14.192377 1.066899 1
UPS United Parcel Service Industrials Air Freight & Logistics 96.230003 -2.797977 0.826408 196.000000 44.000000 439000000.000000 4844000000.000000 5.380000 900371747.200000 17.886618 1.069558 1
UTX United Technologies Industrials Industrial Conglomerates 96.070000 8.065239 0.949396 28.000000 31.000000 1630000000.000000 7608000000.000000 8.720000 872477064.200000 11.017202 -13.198055 1
VAR Varian Medical Systems Health Care Health Care Equipment 80.800003 9.248248 1.034843 24.000000 61.000000 -3800000.000000 411500000.000000 4.130000 99636803.870000 19.564165 9.471400 1
VLO Valero Energy Energy Oil & Gas Refining & Marketing & Transportation 70.709999 17.341522 1.626934 19.000000 56.000000 425000000.000000 3990000000.000000 8.000000 498750000.000000 8.838750 15.262155 1
VMC Vulcan Materials Materials Construction Materials 94.970001 6.028805 1.845710 5.000000 81.000000 142787000.000000 221177000.000000 1.660000 133239156.600000 57.210844 -0.266191 1
VNO Vornado Realty Trust Real Estate REITs 99.959999 10.027519 1.019724 11.000000 47.000000 637230000.000000 760434000.000000 3.610000 210646537.400000 27.689750 -1.081912 1
VRSK Verisk Analytics Industrials Research & Consulting Services 76.879997 -1.448539 1.454019 37.000000 10.000000 98989000.000000 507577000.000000 3.070000 165334527.700000 25.042344 -13.617440 1
VRSN Verisign Inc. Information Technology Internet Software & Services 87.360001 23.459580 1.379480 35.000000 127.000000 37051000.000000 375236000.000000 3.290000 114053495.400000 26.553192 4.076543 1
VTR Ventas Inc Real Estate REITs 56.430000 0.213104 1.444924 4.000000 47.000000 -1803000.000000 419222000.000000 1.260000 332715873.000000 44.785714 -4.040751 1
WEC Wec Energy Group Inc Utilities Electric Utilities 51.310001 -1.986623 1.103033 7.000000 2.000000 -12100000.000000 640300000.000000 2.360000 271313559.300000 21.741526 -1.850995 1
WHR Whirlpool Corp. Consumer Discretionary Household Appliances 146.869995 -0.230971 2.397803 17.000000 10.000000 -254000000.000000 783000000.000000 9.950000 78693467.340000 14.760804 -45.086335 1
WM Waste Management Inc. Industrials Environmental Services 53.369999 7.061186 0.940366 14.000000 2.000000 -1268000000.000000 753000000.000000 1.660000 453614457.800000 32.150602 -1.415299 1
WU Western Union Co Information Technology Internet Software & Services 17.910000 -2.610109 1.273051 60.000000 16.000000 -467300000.000000 837800000.000000 1.630000 513987730.100000 10.987730 -8.043772 1
WY Weyerhaeuser Corp. Real Estate REITs 29.980000 8.544529 1.338067 10.000000 116.000000 -568000000.000000 506000000.000000 0.890000 568539325.800000 33.685393 2.284802 1
WYN Wyndham Worldwide Consumer Discretionary Hotels, Resorts & Cruise Lines 72.650002 1.000976 1.331918 64.000000 9.000000 -12000000.000000 612000000.000000 5.180000 118146718.100000 14.025097 -10.249967 1
XEL Xcel Energy Inc Utilities MultiUtilities 35.910000 1.383405 1.015052 9.000000 2.000000 5332000.000000 984485000.000000 1.940000 507466494.800000 18.510309 -2.261927 1
XL XL Capital Financials Property & Casualty Insurance 39.180000 7.696534 0.991011 10.000000 99.000000 734422000.000000 1201560000.000000 4.220000 284729857.800000 9.284360 -7.762677 1
XRAY Dentsply Sirona Health Care Health Care Supplies 60.849998 19.901474 1.007230 11.000000 60.000000 133000000.000000 251200000.000000 1.790000 140335195.500000 33.994412 0.855096 1
XRX Xerox Corp. Information Technology IT Consulting & Other Services 10.630000 9.474768 1.866680 5.000000 26.000000 -43000000.000000 474000000.000000 0.420000 1128571429.000000 25.309524 -0.295949 1
XYL Xylem Inc. Industrials Industrial Conglomerates 36.500000 11.009729 1.166311 16.000000 83.000000 17000000.000000 340000000.000000 1.880000 180851063.800000 19.414894 4.130471 1
YUM Yum! Brands Inc Consumer Discretionary Restaurants 52.516175 -8.698917 1.478877 142.000000 27.000000 159000000.000000 1293000000.000000 2.970000 435353535.400000 17.682214 -3.838260 1
ZBH Zimmer Biomet Holdings Health Care Health Care Equipment 102.589996 9.347683 1.404206 1.000000 100.000000 376000000.000000 147000000.000000 0.780000 188461538.500000 131.525636 -23.884449 1
ZION Zions Bancorp Financials Regional Banks 27.299999 -1.158588 1.468176 4.000000 99.000000 -43623000.000000 309471000.000000 1.200000 257892500.000000 22.749999 -0.063096 1
ZTS Zoetis Health Care Pharmaceuticals 47.919998 16.678836 1.610285 32.000000 65.000000 272000000.000000 339000000.000000 0.680000 498529411.800000 70.470585 1.723068 1
1 C Citigroup Inc. Financials Banks 51.750000 4.714695 1.261984 8.000000 99.000000 -11208000000.000000 17242000000.000000 5.410000 3187060998.000000 9.565619 -1.167533 1
F Ford Motor Consumer Discretionary Automobile Manufacturers 14.090000 2.398256 1.151454 26.000000 43.000000 3515000000.000000 7373000000.000000 1.860000 3963978495.000000 7.575269 5.108756 1
GILD Gilead Sciences Health Care Biotechnology 101.190002 2.689264 1.494060 98.000000 148.000000 2824000000.000000 18108000000.000000 12.370000 1463864188.000000 8.180275 3.159446 1
INTC Intel Corp. Information Technology Semiconductors 34.450001 14.035095 1.226022 19.000000 162.000000 12747000000.000000 11420000000.000000 2.410000 4738589212.000000 14.294606 3.954975 1
JPM JPMorgan Chase & Co. Financials Banks 66.029999 8.033377 1.130337 10.000000 99.000000 -7341000000.000000 24442000000.000000 6.050000 4040000000.000000 10.914049 -1.886881 1
KO Coca Cola Company Consumer Staples Soft Drinks 42.959999 6.812526 0.889913 29.000000 74.000000 -1649000000.000000 7351000000.000000 1.690000 4349704142.000000 25.420118 -1.466307 1
PFE Pfizer Inc. Health Care Pharmaceuticals 32.279999 3.130991 1.238748 11.000000 79.000000 298000000.000000 6960000000.000000 1.130000 6159292035.000000 28.566371 -4.213309 1
T AT&T Inc Telecommunications Services Integrated Telecommunications Services 34.410000 5.942118 0.859442 11.000000 11.000000 -3482000000.000000 13345000000.000000 2.370000 5630801688.000000 14.518987 -23.537323 1
VZ Verizon Communications Telecommunications Services Integrated Telecommunications Services 46.220001 6.277303 0.842592 109.000000 14.000000 -6128000000.000000 17879000000.000000 4.380000 4081963470.000000 10.552512 -26.380687 1
WFC Wells Fargo Financials Banks 54.360001 5.532912 0.969774 12.000000 99.000000 -460000000.000000 22894000000.000000 4.180000 5477033493.000000 13.004785 -0.938007 1
XOM Exxon Mobil Corp. Energy Integrated Oil & Gas 77.949997 3.656915 1.370062 9.000000 7.000000 -911000000.000000 16150000000.000000 3.850000 4194805195.000000 20.246752 -2.706443 1
2 ADBE Adobe Systems Inc Information Technology Application Software 93.940002 13.977195 1.357679 9.000000 180.000000 -240840000.000000 629551000.000000 1.260000 499643650.800000 74.555557 4.199651 1
ADI Analog Devices, Inc. Information Technology Semiconductors 55.320000 -1.827858 1.701169 14.000000 272.000000 315120000.000000 696878000.000000 0.310000 2247993548.000000 178.451613 1.059810 1
ADS Alliance Data Systems Information Technology Data Processing & Outsourced Services 276.570007 6.189286 1.116976 30.000000 25.000000 90885000.000000 596541000.000000 8.910000 66951851.850000 31.040405 129.064585 1
AMGN Amgen Inc Health Care Biotechnology 162.330002 17.163478 1.630259 25.000000 362.000000 413000000.000000 6939000000.000000 9.150000 758360655.700000 17.740984 24.012322 1
AVGO Broadcom Information Technology Semiconductors 145.149994 17.902683 1.847180 29.000000 163.000000 218000000.000000 1364000000.000000 2.860000 1044055944.000000 18.249407 3.954975 1
BAC Bank of America Corp Financials Banks 16.830000 8.440722 1.418688 6.000000 99.000000 20764000000.000000 15888000000.000000 4.180000 845069512.200000 13.004785 -0.938007 1
CELG Celgene Corp. Health Care Biotechnology 119.760002 8.448793 2.000828 27.000000 333.000000 758700000.000000 1602000000.000000 2.020000 793069306.900000 59.287130 -4.320051 1
CMG Chipotle Mexican Grill Consumer Discretionary Restaurants 479.850006 -33.131268 2.474002 22.000000 237.000000 -171460000.000000 475602000.000000 15.300000 31085098.040000 31.362745 17.201329 1
EBAY eBay Inc. Information Technology Internet Software & Services 27.480000 12.163265 1.409302 26.000000 271.000000 -4496000000.000000 1725000000.000000 1.430000 1206293706.000000 19.216783 4.601699 1
EQIX Equinix Real Estate REITs 302.399994 10.019650 1.308082 7.000000 164.000000 1617921000.000000 187774000.000000 3.250000 57776615.380000 93.046152 23.856728 1
EW Edwards Lifesciences Health Care Health Care Equipment 78.980003 11.616734 1.666482 20.000000 257.000000 64600000.000000 494900000.000000 2.300000 215173913.000000 34.339132 6.349747 1
FB Facebook Information Technology Internet Software & Services 104.660004 16.224320 1.320606 8.000000 958.000000 592000000.000000 3669000000.000000 1.310000 2800763359.000000 79.893133 5.884467 1
FSLR First Solar Inc Information Technology Semiconductors 65.989998 55.051683 2.075216 10.000000 190.000000 -355228000.000000 546421000.000000 5.420000 100815682.700000 12.175276 22.563791 1
FTR Frontier Communications Telecommunications Services Integrated Telecommunications Services 4.670000 -2.301255 2.026818 3.000000 496.000000 254000000.000000 -196000000.000000 -0.290000 675862069.000000 14.518987 10.497704 1
HAL Halliburton Co. Energy Oil & Gas Equipment & Services 34.040001 -5.101751 1.966062 4.000000 189.000000 7786000000.000000 -671000000.000000 -0.790000 849367088.600000 93.089287 17.345857 1
MCD McDonald's Corp. Consumer Discretionary Restaurants 118.139999 19.939085 0.733163 64.000000 260.000000 5607600000.000000 4529300000.000000 4.820000 939688796.700000 24.510373 7.122145 1
MNST Monster Beverage Consumer Staples Soft Drinks 49.653332 10.800357 1.585944 11.000000 568.000000 1805094000.000000 546733000.000000 3.710000 1469541779.000000 25.420118 -5.190734 1
NEM Newmont Mining Corp. (Hldg. Co.) Materials Gold 17.990000 10.844116 2.536050 2.000000 198.000000 379000000.000000 220000000.000000 0.430000 511627907.000000 41.837209 6.971864 1
SWKS Skyworks Solutions Information Technology Semiconductors 76.830002 -8.513933 2.017394 25.000000 225.000000 237800000.000000 798300000.000000 4.210000 189619952.500000 18.249407 7.413777 1
TRIP TripAdvisor Consumer Discretionary Internet & Direct Marketing Retail 85.250000 34.803917 1.578344 14.000000 212.000000 159000000.000000 198000000.000000 1.380000 143478260.900000 61.775362 2.627576 1
VRTX Vertex Pharmaceuticals Inc Health Care Biotechnology 125.830002 21.928300 2.456535 59.000000 221.000000 89509000.000000 -556334000.000000 -2.310000 240837229.400000 39.602928 2.559671 1
WAT Waters Corporation Health Care Health Care Distributors 134.580002 13.925341 1.044615 23.000000 425.000000 65488000.000000 469053000.000000 5.700000 82290000.000000 23.610527 29.547150 1
WYNN Wynn Resorts Ltd Consumer Discretionary Casinos & Gaming 69.190002 29.496541 3.794783 174.000000 198.000000 -102075000.000000 195290000.000000 1.930000 101186528.500000 35.849742 12.695712 1
YHOO Yahoo Inc. Information Technology Internet Software & Services 33.259998 14.887727 1.845149 15.000000 459.000000 -1032187000.000000 -4359082000.000000 -4.640000 939457327.600000 28.976191 6.261775 1
3 ALXN Alexion Pharmaceuticals Health Care Biotechnology 190.750000 22.338380 2.022921 2.000000 195.000000 66000000.000000 144000000.000000 0.680000 211764705.900000 280.514706 -14.171389 1
AMZN Amazon.com Inc Consumer Discretionary Internet & Direct Marketing Retail 675.890015 32.268105 1.460386 4.000000 58.000000 1333000000.000000 596000000.000000 1.280000 465625000.000000 528.039074 3.904430 1
ISRG Intuitive Surgical Inc. Health Care Health Care Equipment 546.159973 18.733013 1.126009 14.000000 317.000000 114300000.000000 588800000.000000 15.870000 37101449.280000 34.414617 42.607500 1
NFLX Netflix Inc. Information Technology Internet Software & Services 114.379997 11.145654 2.605949 6.000000 65.000000 695722000.000000 122641000.000000 0.290000 422900000.000000 394.413783 -5.700168 1
PCLN Priceline.com Inc Consumer Discretionary Internet & Direct Marketing Retail 1274.949951 3.190527 1.268340 29.000000 184.000000 -1671386000.000000 2551360000.000000 50.090000 50935516.070000 25.453183 -1.052429 1
REGN Regeneron Health Care Biotechnology 542.869995 16.995320 1.802345 17.000000 129.000000 160383000.000000 636056000.000000 6.170000 103088492.700000 87.985412 20.409000 1
4 APA Apache Corporation Energy Oil & Gas Exploration & Production 44.470001 11.397804 2.405408 917.000000 80.000000 698000000.000000 -23528000000.000000 -61.200000 384444444.400000 93.089287 4.970809 1
CHK Chesapeake Energy Energy Integrated Oil & Gas 4.500000 -38.101788 4.559815 687.000000 22.000000 -3283000000.000000 -14685000000.000000 -22.430000 654703522.100000 28.407929 -1.840528 1
5 APC Anadarko Petroleum Corp Energy Oil & Gas Exploration & Production 48.580002 -20.802083 2.435165 52.000000 22.000000 -6430000000.000000 -6692000000.000000 -13.180000 507738998.500000 93.089287 -12.860938 1
ARNC Arconic Inc Industrials Aerospace & Defense 7.398807 1.647784 2.592065 3.000000 37.000000 42000000.000000 -322000000.000000 -0.310000 1038709677.000000 18.687607 2.639814 1
BHI Baker Hughes Inc Energy Oil & Gas Equipment & Services 46.150002 -12.312367 2.559553 12.000000 84.000000 584000000.000000 -1967000000.000000 -4.490000 438084632.500000 93.089287 13.490544 1
COG Cabot Oil & Gas Energy Oil & Gas Exploration & Production 17.690001 -20.099360 3.055818 6.000000 0.000000 -20440000.000000 -113891000.000000 -0.280000 406753571.400000 93.089287 -0.223147 1
CXO Concho Resources Energy Oil & Gas Exploration & Production 92.860001 -2.744032 2.692546 1.000000 38.000000 228529000.000000 65900000.000000 0.540000 122037037.000000 171.962965 5.673991 1
DVN Devon Energy Corp. Energy Oil & Gas Exploration & Production 32.000000 -15.478079 2.923698 205.000000 70.000000 830000000.000000 -14454000000.000000 -35.550000 406582278.500000 93.089287 1.785616 1
EOG EOG Resources Energy Oil & Gas Exploration & Production 70.790001 -4.078593 1.941104 35.000000 39.000000 -1368707000.000000 -4524515000.000000 -8.290000 545779855.200000 93.089287 1.416243 1
EQT EQT Corporation Energy Oil & Gas Exploration & Production 52.130001 -21.253771 2.364883 2.000000 201.000000 523803000.000000 85171000.000000 0.560000 152091071.400000 93.089287 9.567952 1
FCX Freeport-McMoran Cp & Gld Materials Copper 6.770000 -31.685167 3.796410 155.000000 5.000000 -240000000.000000 -12156000000.000000 -11.310000 1074801061.000000 22.811951 2.935427 1
HES Hess Corporation Energy Integrated Oil & Gas 48.480000 -4.585713 2.398580 16.000000 103.000000 272000000.000000 -3056000000.000000 -10.780000 283487940.600000 28.407929 6.264817 1
HPE Hewlett Packard Enterprise Information Technology Technology Hardware, Storage & Peripherals 15.200000 -17.837838 3.400491 7.000000 45.000000 7523000000.000000 2461000000.000000 1.800000 513987730.100000 25.309524 3.954975 1
KMI Kinder Morgan Energy Oil & Gas Refining & Marketing & Transportation 14.920000 -47.129693 3.139352 1.000000 7.000000 -86000000.000000 253000000.000000 0.100000 2530000000.000000 149.200000 -1.894071 1
MOS The Mosaic Company Materials Fertilizers & Agricultural Chemicals 27.590000 -11.229086 2.830675 10.000000 62.000000 -1098300000.000000 1000400000.000000 2.790000 358566308.200000 9.888889 5.846617 1
MRO Marathon Oil Corp. Energy Oil & Gas Exploration & Production 12.590000 -20.265991 3.325386 12.000000 71.000000 -1177000000.000000 -2204000000.000000 -3.260000 676073619.600000 93.089287 1.273530 1
MUR Murphy Oil Energy Integrated Oil & Gas 22.450001 -8.591197 2.851180 43.000000 27.000000 -910125000.000000 -2270833000.000000 -13.030000 174277283.200000 28.407929 -1.298006 1
NBL Noble Energy Inc Energy Oil & Gas Exploration & Production 32.930000 7.298791 2.509437 24.000000 57.000000 -155000000.000000 -2441000000.000000 -6.070000 402141680.400000 93.089287 1.171229 1
NFX Newfield Exploration Co Energy Oil & Gas Exploration & Production 32.560001 -3.296695 2.421529 244.000000 1.000000 -9000000.000000 -3362000000.000000 -21.180000 158734655.300000 93.089287 -0.138596 1
NOV National Oilwell Varco Inc. Energy Oil & Gas Equipment & Services 33.490002 -12.558739 1.952020 5.000000 49.000000 -1456000000.000000 -769000000.000000 -1.990000 386432160.800000 93.089287 9.582536 1
OKE ONEOK Energy Oil & Gas Exploration & Production 24.660000 -24.123077 3.560178 73.000000 6.000000 -75150000.000000 244977000.000000 1.170000 209382051.300000 21.076923 -8.025110 1
OXY Occidental Petroleum Energy Oil & Gas Exploration & Production 67.610001 0.865287 1.589520 32.000000 64.000000 -588000000.000000 -7829000000.000000 -10.230000 765298142.700000 93.089287 3.345102 1
PWR Quanta Services Inc. Industrials Industrial Conglomerates 20.250000 -16.632362 2.954291 10.000000 11.000000 -61744000.000000 321824000.000000 1.590000 202405031.400000 12.735849 4.291894 1
RRC Range Resources Corp. Energy Oil & Gas Exploration & Production 24.610001 -25.106512 3.712995 26.000000 0.000000 23000.000000 -713685000.000000 -4.290000 166360139.900000 93.089287 0.525090 1
SE Spectra Energy Corp. Energy Oil & Gas Refining & Marketing & Transportation 23.940001 -9.898378 2.030786 3.000000 6.000000 -2000000.000000 196000000.000000 0.290000 675862069.000000 82.551728 -2.580408 1
SWN Southwestern Energy Energy Oil & Gas Exploration & Production 7.110000 -44.798137 4.580042 200.000000 2.000000 -38000000.000000 -4556000000.000000 -6.070000 402141680.400000 93.089287 1.273530 1
TDC Teradata Corp. Information Technology Application Software 26.420000 -8.833678 2.730659 25.000000 88.000000 5000000.000000 -214000000.000000 -1.530000 139869281.000000 74.555557 4.068084 1
WMB Williams Cos. Energy Oil & Gas Exploration & Production 25.700001 -30.988186 3.719560 9.000000 4.000000 -140000000.000000 -571000000.000000 -0.760000 751315789.500000 93.089287 -14.561121 1
XEC Cimarex Energy Energy Oil & Gas Exploration & Production 89.379997 -14.403372 2.397940 86.000000 190.000000 373520000.000000 -2408948000.000000 -25.920000 92937808.640000 93.089287 7.186128 1
In [180]:
## Complete the code to print the companies in each cluster
for cl in df1["KM_segments"].unique():
    print("In cluster {}, the following companies are present:".format(cl))
    print(df1[df1["KM_segments"] == cl]["Security"].unique())
    print()
In cluster 0, the following companies are present:
['American Airlines Group' 'AbbVie' 'Abbott Laboratories'
 'Archer-Daniels-Midland Co' 'Ameren Corp' 'American Electric Power'
 'AFLAC Inc' 'American International Group, Inc.'
 'Apartment Investment & Mgmt' 'Assurant Inc' 'Arthur J. Gallagher & Co.'
 'Akamai Technologies Inc' 'Albemarle Corp' 'Alaska Air Group Inc'
 'Allstate Corp' 'Allegion' 'Applied Materials Inc' 'AMETEK Inc'
 'Affiliated Managers Group Inc' 'Ameriprise Financial'
 'American Tower Corp A' 'AutoNation Inc' 'Anthem Inc.' 'Aon plc'
 'Amphenol Corp' 'Activision Blizzard' 'AvalonBay Communities, Inc.'
 'American Water Works Company Inc' 'American Express Co' 'Boeing Company'
 'Baxter International Inc.' 'BB&T Corporation' 'Bard (C.R.) Inc.'
 'BIOGEN IDEC Inc.' 'The Bank of New York Mellon Corp.' 'Ball Corp'
 'Bristol-Myers Squibb' 'Boston Scientific' 'BorgWarner'
 'Boston Properties' 'Caterpillar Inc.' 'Chubb Limited' 'CBRE Group'
 'Crown Castle International Corp.' 'Carnival Corp.'
 'CF Industries Holdings Inc' 'Citizens Financial Group' 'Church & Dwight'
 'C. H. Robinson Worldwide' 'Charter Communications' 'CIGNA Corp.'
 'Cincinnati Financial' 'Colgate-Palmolive' 'Comerica Inc.'
 'CME Group Inc.' 'Cummins Inc.' 'CMS Energy' 'Centene Corporation'
 'CenterPoint Energy' 'Capital One Financial' 'The Cooper Companies'
 'CSX Corp.' 'CenturyLink Inc' 'Cognizant Technology Solutions'
 'Citrix Systems' 'CVS Health' 'Chevron Corp.' 'Dominion Resources'
 'Delta Air Lines' 'Du Pont (E.I.)' 'Deere & Co.'
 'Discover Financial Services' 'Quest Diagnostics' 'Danaher Corp.'
 'The Walt Disney Company' 'Discovery Communications-A'
 'Discovery Communications-C' 'Delphi Automotive' 'Digital Realty Trust'
 'Dun & Bradstreet' 'Dover Corp.' 'Dr Pepper Snapple Group' 'Duke Energy'
 'DaVita Inc.' 'Ecolab Inc.' 'Consolidated Edison' 'Equifax Inc.'
 "Edison Int'l" 'Eastman Chemical' 'Equity Residential'
 'Eversource Energy' 'Essex Property Trust, Inc.' 'E*Trade'
 'Eaton Corporation' 'Entergy Corp.' 'Exelon Corp.' "Expeditors Int'l"
 'Expedia Inc.' 'Extra Space Storage' 'Fastenal Co'
 'Fortune Brands Home & Security' 'FirstEnergy Corp'
 'Fidelity National Information Services' 'Fiserv Inc' 'FLIR Systems'
 'Fluor Corp.' 'Flowserve Corporation' 'FMC Corporation'
 'Federal Realty Investment Trust' 'General Dynamics'
 'General Growth Properties Inc.' 'Corning Inc.' 'General Motors'
 'Genuine Parts' 'Garmin Ltd.' 'Goodyear Tire & Rubber'
 'Grainger (W.W.) Inc.' 'Hasbro Inc.' 'Huntington Bancshares'
 'HCA Holdings' 'Welltower Inc.' 'HCP Inc.' 'Hartford Financial Svc.Gp.'
 'Harley-Davidson' "Honeywell Int'l Inc." 'HP Inc.' 'Hormel Foods Corp.'
 'Henry Schein' 'Host Hotels & Resorts' 'The Hershey Company'
 'Humana Inc.' 'International Business Machines' 'IDEXX Laboratories'
 'Intl Flavors & Fragrances' 'International Paper' 'Interpublic Group'
 'Iron Mountain Incorporated' 'Illinois Tool Works' 'Invesco Ltd.'
 'J. B. Hunt Transport Services' 'Jacobs Engineering Group'
 'Juniper Networks' 'Kimco Realty' 'Kimberly-Clark' 'Kansas City Southern'
 'Leggett & Platt' 'Lennar Corp.' 'Laboratory Corp. of America Holding'
 'LKQ Corporation' 'L-3 Communications Holdings' 'Lilly (Eli) & Co.'
 'Lockheed Martin Corp.' 'Alliant Energy Corp' 'Leucadia National Corp.'
 'Southwest Airlines' 'Level 3 Communications' 'LyondellBasell'
 'Mastercard Inc.' 'Mid-America Apartments' 'Macerich' "Marriott Int'l."
 'Masco Corp.' 'Mattel Inc.' "Moody's Corp" 'Mondelez International'
 'MetLife Inc.' 'Mohawk Industries' 'Mead Johnson' 'McCormick & Co.'
 'Martin Marietta Materials' 'Marsh & McLennan' '3M Company'
 'Altria Group Inc' 'Marathon Petroleum' 'Merck & Co.' 'M&T Bank Corp.'
 'Mettler Toledo' 'Mylan N.V.' 'Navient' 'NASDAQ OMX Group'
 'NextEra Energy' 'Nielsen Holdings' 'Norfolk Southern Corp.'
 'Northern Trust Corp.' 'Nucor Corp.' 'Newell Brands'
 'Realty Income Corporation' 'Omnicom Group' "O'Reilly Automotive"
 "People's United Financial" 'Pitney-Bowes' 'PACCAR Inc.' 'PG&E Corp.'
 'Public Serv. Enterprise Inc.' 'PepsiCo Inc.' 'Principal Financial Group'
 'Procter & Gamble' 'Progressive Corp.' 'Pulte Homes Inc.'
 'Philip Morris International' 'PNC Financial Services' 'Pentair Ltd.'
 'Pinnacle West Capital' 'PPG Industries' 'PPL Corp.'
 'Prudential Financial' 'Phillips 66' 'Praxair Inc.' 'PayPal'
 'Ryder System' 'Royal Caribbean Cruises Ltd' 'Robert Half International'
 'Roper Industries' 'Republic Services Inc' 'SCANA Corp'
 'Charles Schwab Corporation' 'Sealed Air' 'Sherwin-Williams'
 'SL Green Realty' 'Scripps Networks Interactive Inc.' 'Southern Co.'
 'Simon Property Group Inc' 'S&P Global, Inc.' 'Stericycle Inc'
 'Sempra Energy' 'SunTrust Banks' 'State Street Corp.'
 'Synchrony Financial' 'Stryker Corp.' 'Molson Coors Brewing Company'
 'Tegna, Inc.' 'Torchmark Corp.' 'Thermo Fisher Scientific'
 'The Travelers Companies Inc.' 'Tractor Supply Company' 'Tyson Foods'
 'Tesoro Petroleum Co.' 'Total System Services' 'Texas Instruments'
 'Under Armour' 'United Continental Holdings' 'UDR Inc'
 'Universal Health Services, Inc.' 'United Health Group Inc.' 'Unum Group'
 'Union Pacific' 'United Parcel Service' 'United Technologies'
 'Varian Medical Systems' 'Valero Energy' 'Vulcan Materials'
 'Vornado Realty Trust' 'Verisk Analytics' 'Verisign Inc.' 'Ventas Inc'
 'Wec Energy Group Inc' 'Whirlpool Corp.' 'Waste Management Inc.'
 'Western Union Co' 'Weyerhaeuser Corp.' 'Wyndham Worldwide'
 'Xcel Energy Inc' 'XL Capital' 'Dentsply Sirona' 'Xerox Corp.'
 'Xylem Inc.' 'Yum! Brands Inc' 'Zimmer Biomet Holdings' 'Zions Bancorp'
 'Zoetis']

In cluster 2, the following companies are present:
['Adobe Systems Inc' 'Analog Devices, Inc.' 'Alliance Data Systems'
 'Amgen Inc' 'Broadcom' 'Bank of America Corp' 'Celgene Corp.'
 'Chipotle Mexican Grill' 'eBay Inc.' 'Equinix' 'Edwards Lifesciences'
 'Facebook' 'First Solar Inc' 'Frontier Communications' 'Halliburton Co.'
 "McDonald's Corp." 'Monster Beverage' 'Newmont Mining Corp. (Hldg. Co.)'
 'Skyworks Solutions' 'TripAdvisor' 'Vertex Pharmaceuticals Inc'
 'Waters Corporation' 'Wynn Resorts Ltd' 'Yahoo Inc.']

In cluster 3, the following companies are present:
['Alexion Pharmaceuticals' 'Amazon.com Inc' 'Intuitive Surgical Inc.'
 'Netflix Inc.' 'Priceline.com Inc' 'Regeneron']

In cluster 4, the following companies are present:
['Apache Corporation' 'Chesapeake Energy']

In cluster 5, the following companies are present:
['Anadarko Petroleum Corp' 'Arconic Inc' 'Baker Hughes Inc'
 'Cabot Oil & Gas' 'Concho Resources' 'Devon Energy Corp.' 'EOG Resources'
 'EQT Corporation' 'Freeport-McMoran Cp & Gld' 'Hess Corporation'
 'Hewlett Packard Enterprise' 'Kinder Morgan' 'The Mosaic Company'
 'Marathon Oil Corp.' 'Murphy Oil' 'Noble Energy Inc'
 'Newfield Exploration Co' 'National Oilwell Varco Inc.' 'ONEOK'
 'Occidental Petroleum' 'Quanta Services Inc.' 'Range Resources Corp.'
 'Spectra Energy Corp.' 'Southwestern Energy' 'Teradata Corp.'
 'Williams Cos.' 'Cimarex Energy']

In cluster 1, the following companies are present:
['Citigroup Inc.' 'Ford Motor' 'Gilead Sciences' 'Intel Corp.'
 'JPMorgan Chase & Co.' 'Coca Cola Company' 'Pfizer Inc.' 'AT&T Inc'
 'Verizon Communications' 'Wells Fargo' 'Exxon Mobil Corp.']

In [181]:
df1.groupby(["KM_segments", "GICS Sector"])['Security'].count()
Out[181]:
KM_segments  GICS Sector                
0            Consumer Discretionary         33
             Consumer Staples               17
             Energy                          5
             Financials                     45
             Health Care                    30
             Industrials                    51
             Information Technology         20
             Materials                      17
             Real Estate                    26
             Telecommunications Services     2
             Utilities                      24
1            Consumer Discretionary          1
             Consumer Staples                1
             Energy                          1
             Financials                      3
             Health Care                     2
             Information Technology          1
             Telecommunications Services     2
2            Consumer Discretionary          4
             Consumer Staples                1
             Energy                          1
             Financials                      1
             Health Care                     5
             Information Technology          9
             Materials                       1
             Real Estate                     1
             Telecommunications Services     1
3            Consumer Discretionary          2
             Health Care                     3
             Information Technology          1
4            Energy                          2
5            Energy                         21
             Industrials                     2
             Information Technology          2
             Materials                       2
Name: Security, dtype: int64
In [182]:
plt.figure(figsize=(20, 20))
plt.suptitle("Boxplot of numerical variables for each cluster")

# selecting numerical columns
num_col = df.select_dtypes(include=np.number).columns.tolist()

for i, variable in enumerate(num_col):
    plt.subplot(3, 4, i + 1)
    sns.boxplot(data=df1, x="KM_segments", y=variable)

plt.tight_layout(pad=2.0)

Insights¶

-

Hierarchical Clustering¶

Computing Cophenetic Correlation¶

In [183]:
hc_df = subset_scaled_df.copy()

Error: ValueError: The condensed distance matrix must contain only finite values.

Reference: ValueError: The condensed distance matrix must contain only finite values. in python

Quote: There are question marks in your input dataset

In [184]:
hc_df
Out[184]:
Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio
0 -0.393341 0.493950 0.272749 0.989601 -0.210698 -0.339355 1.554415 1.309399 0.107863 -0.652487 -0.506653
1 -0.220837 0.355439 1.137045 0.937737 0.077269 -0.002335 0.927628 0.056755 1.250274 -0.311769 -0.504205
2 -0.367195 0.602479 -0.427007 -0.192905 -0.033488 0.454058 0.744371 0.024831 1.098021 -0.391502 0.094941
3 0.133567 0.825696 -0.284802 -0.317379 1.218059 -0.152497 -0.219816 -0.230563 -0.091622 0.947148 0.424333
4 -0.260874 -0.492636 0.296470 -0.265515 2.237018 0.133564 -0.202703 -0.374982 1.978399 3.293307 0.199196
... ... ... ... ... ... ... ... ... ... ... ...
335 -0.486181 0.901646 0.540121 -0.255142 4.308162 -0.559673 -1.487784 -1.127481 0.429111 -0.082116 0.572194
336 -0.289510 -1.065766 -0.079703 1.062211 -0.476513 0.053235 -0.051186 0.029391 -0.167741 -0.337154 -0.152012
337 0.221913 0.439539 -0.206067 -0.400362 0.332009 0.164889 -0.342467 -0.303532 -0.460058 2.233634 -1.589390
338 -0.547053 -0.436811 -0.097813 -0.369243 0.320933 -0.051022 -0.301171 -0.239684 -0.377852 -0.222714 0.118680
339 -0.336453 1.051046 0.142671 -0.078803 -0.055639 0.111378 -0.293666 -0.318734 -0.092942 0.854902 0.246754

340 rows × 11 columns

In [185]:
hc_df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 340 entries, 0 to 339
Data columns (total 11 columns):
 #   Column                        Non-Null Count  Dtype  
---  ------                        --------------  -----  
 0   Current Price                 340 non-null    float64
 1   Price Change                  340 non-null    float64
 2   Volatility                    340 non-null    float64
 3   ROE                           340 non-null    float64
 4   Cash Ratio                    340 non-null    float64
 5   Net Cash Flow                 340 non-null    float64
 6   Net Income                    340 non-null    float64
 7   Earnings Per Share            340 non-null    float64
 8   Estimated Shares Outstanding  340 non-null    float64
 9   P/E Ratio                     340 non-null    float64
 10  P/B Ratio                     340 non-null    float64
dtypes: float64(11)
memory usage: 29.3 KB

pandas.isna.)

In [186]:
hc_df.isna()
Out[186]:
Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio
0 False False False False False False False False False False False
1 False False False False False False False False False False False
2 False False False False False False False False False False False
3 False False False False False False False False False False False
4 False False False False False False False False False False False
... ... ... ... ... ... ... ... ... ... ... ...
335 False False False False False False False False False False False
336 False False False False False False False False False False False
337 False False False False False False False False False False False
338 False False False False False False False False False False False
339 False False False False False False False False False False False

340 rows × 11 columns

In [187]:
len(hc_df[col])
Out[187]:
340
In [188]:
type(len(hc_df[col]))
Out[188]:
int
In [189]:
hc_df.columns
Out[189]:
Index(['Current Price', 'Price Change', 'Volatility', 'ROE', 'Cash Ratio',
       'Net Cash Flow', 'Net Income', 'Earnings Per Share',
       'Estimated Shares Outstanding', 'P/E Ratio', 'P/B Ratio'],
      dtype='object')
In [190]:
count=0
for col in hc_df.columns:
    for i in range(len(hc_df[col])):
        if pd.isna(hc_df[col][i])==True:
            count+=1
    print("count of na's in col:", col, "is:")
    print(count)
    count=0
count of na's in col: Current Price is:
0
count of na's in col: Price Change is:
0
count of na's in col: Volatility is:
0
count of na's in col: ROE is:
0
count of na's in col: Cash Ratio is:
0
count of na's in col: Net Cash Flow is:
0
count of na's in col: Net Income is:
0
count of na's in col: Earnings Per Share is:
0
count of na's in col: Estimated Shares Outstanding is:
0
count of na's in col: P/E Ratio is:
0
count of na's in col: P/B Ratio is:
0
In [191]:
len(hc_df)
Out[191]:
340

Bug finite values for jensenshannon distance metric with linkage and cophenet: [Workaround]:¶

error: ValueError: The condensed distance matrix must contain only finite values.

workaround: remove jensenshannon distance_metric

(see next code cell below:)

In [192]:
# list of distance metrics

# https://docs.scipy.org/doc/scipy/reference/spatial.distance.html

# excluded `"jensenshannon", ` due to: 
# error: ValueError: The condensed distance matrix must contain only finite values.
# https://github.com/SegataLab/hclust2/issues/3
# https://github.com/CoderSales/unsupervised-learning-clustering/issues/7


distance_metrics = ["braycurtis", "canberra", "chebyshev", "cityblock", "correlation", "cosine", "euclidean", "mahalanobis", "minkowski", "seuclidean", "sqeuclidean"] ## Complete the code to add distance metrics

# list of linkage methods

# https://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.linkage.html

# 'ward' excluded due to error:
# ValueError: Method 'ward' requires the distance metric to be Euclidean

linkage_methods = ["single", "complete", "average", "weighted"] ## Complete the code to add linkages

# distance_metrics = ["braycurtis", "canberra", "chebyshev", "cityblock", "correlation", "cosine", "euclidean", "jensenshannon", "mahalanobis", "minkowski", "seuclidean", "sqeuclidean"] ## Complete the code to add distance metrics
# linkage_methods = ["single", "complete", "average", "weighted"] ## Complete the code to add linkages
# gave error:
# ValueError: The condensed distance matrix must contain only finite values.

high_cophenet_corr = 0
high_dm_lm = [0, 0]

for dm in distance_metrics:
    for lm in linkage_methods:
        Z = linkage(hc_df, metric=dm, method=lm)
        c, coph_dists = cophenet(Z, pdist(hc_df))
        print(
            "Cophenetic correlation for {} distance and {} linkage is {}.".format(
                dm.capitalize(), lm, c
            )
        )
        if high_cophenet_corr < c:
            high_cophenet_corr = c
            high_dm_lm[0] = dm
            high_dm_lm[1] = lm
            
# printing the combination of distance metric and linkage method with the highest cophenetic correlation
print('*'*100)
print(
    "Highest cophenetic correlation is {}, which is obtained with {} distance and {} linkage.".format(
        high_cophenet_corr, high_dm_lm[0].capitalize(), high_dm_lm[1]
    )
)
Cophenetic correlation for Braycurtis distance and single linkage is 0.5212071810658095.
Cophenetic correlation for Braycurtis distance and complete linkage is 0.10240430426791322.
Cophenetic correlation for Braycurtis distance and average linkage is 0.32627435525839565.
Cophenetic correlation for Braycurtis distance and weighted linkage is 0.20642920853912072.
Cophenetic correlation for Canberra distance and single linkage is 0.3154284565587037.
Cophenetic correlation for Canberra distance and complete linkage is 0.12703984768895782.
Cophenetic correlation for Canberra distance and average linkage is 0.28553906567883447.
Cophenetic correlation for Canberra distance and weighted linkage is 0.1626519582860221.
Cophenetic correlation for Chebyshev distance and single linkage is 0.9062538164750717.
Cophenetic correlation for Chebyshev distance and complete linkage is 0.598891419111242.
Cophenetic correlation for Chebyshev distance and average linkage is 0.9338265528030499.
Cophenetic correlation for Chebyshev distance and weighted linkage is 0.9127355892367.
Cophenetic correlation for Cityblock distance and single linkage is 0.9334186366528574.
Cophenetic correlation for Cityblock distance and complete linkage is 0.7375328863205818.
Cophenetic correlation for Cityblock distance and average linkage is 0.9302145048594667.
Cophenetic correlation for Cityblock distance and weighted linkage is 0.731045513520281.
Cophenetic correlation for Correlation distance and single linkage is 0.02168228519550047.
Cophenetic correlation for Correlation distance and complete linkage is 0.13026598376888868.
Cophenetic correlation for Correlation distance and average linkage is 0.23298451399122191.
Cophenetic correlation for Correlation distance and weighted linkage is 0.1763411190029438.
Cophenetic correlation for Cosine distance and single linkage is 0.1633637841831045.
Cophenetic correlation for Cosine distance and complete linkage is 0.14558585821013348.
Cophenetic correlation for Cosine distance and average linkage is 0.27565476401031014.
Cophenetic correlation for Cosine distance and weighted linkage is 0.24177997570119666.
Cophenetic correlation for Euclidean distance and single linkage is 0.9232271494002922.
Cophenetic correlation for Euclidean distance and complete linkage is 0.7873280186580672.
Cophenetic correlation for Euclidean distance and average linkage is 0.9422540609560814.
Cophenetic correlation for Euclidean distance and weighted linkage is 0.8693784298129404.
Cophenetic correlation for Mahalanobis distance and single linkage is 0.9259195530524591.
Cophenetic correlation for Mahalanobis distance and complete linkage is 0.792530720285.
Cophenetic correlation for Mahalanobis distance and average linkage is 0.9247324030159737.
Cophenetic correlation for Mahalanobis distance and weighted linkage is 0.8708317490180426.
Cophenetic correlation for Minkowski distance and single linkage is 0.9232271494002922.
Cophenetic correlation for Minkowski distance and complete linkage is 0.7873280186580672.
Cophenetic correlation for Minkowski distance and average linkage is 0.9422540609560814.
Cophenetic correlation for Minkowski distance and weighted linkage is 0.8693784298129404.
Cophenetic correlation for Seuclidean distance and single linkage is 0.923227149400292.
Cophenetic correlation for Seuclidean distance and complete linkage is 0.787328018658067.
Cophenetic correlation for Seuclidean distance and average linkage is 0.9422540609560816.
Cophenetic correlation for Seuclidean distance and weighted linkage is 0.8693784298129404.
Cophenetic correlation for Sqeuclidean distance and single linkage is 0.815145614432825.
Cophenetic correlation for Sqeuclidean distance and complete linkage is 0.7784062963343734.
Cophenetic correlation for Sqeuclidean distance and average linkage is 0.8984640112163556.
Cophenetic correlation for Sqeuclidean distance and weighted linkage is 0.5506923587865349.
****************************************************************************************************
Highest cophenetic correlation is 0.9422540609560816, which is obtained with Seuclidean distance and average linkage.
In [193]:
high_cophenet_corr
Out[193]:
0.9422540609560816
In [194]:
high_dm_lm[0]
Out[194]:
'seuclidean'
In [195]:
high_dm_lm[1]
Out[195]:
'average'

Note on above 3 code cells

post main code cell for cophenet:

scope for variables:

  • high_cophenet_corr
  • high_dm_lm[0]
  • high_dm_lm[1]

in print statement:

print(
    "Highest cophenetic correlation is {}, which is obtained with {} distance and {} linkage.".format(
        high_cophenet_corr, high_dm_lm[0].capitalize(), high_dm_lm[1]
    )
)

must be code cell scope,

hence unavailable in new cells

hence 0's for last 3 cell outputs.

Let's explore different linkage methods with Euclidean distance only.

In [196]:
# list of linkage methods
linkage_methods = ["single", "complete", "average", "weighted"] ## Complete the code to add linkages

high_cophenet_corr = 0
high_dm_lm = [0, 0]

for lm in linkage_methods:
    Z = linkage(hc_df, metric="euclidean", method=lm)
    c, coph_dists = cophenet(Z, pdist(hc_df))
    print("Cophenetic correlation for {} linkage is {}.".format(lm, c))
    if high_cophenet_corr < c:
        high_cophenet_corr = c
        high_dm_lm[0] = "euclidean"
        high_dm_lm[1] = lm
        
# printing the combination of distance metric and linkage method with the highest cophenetic correlation
print('*'*100)
print(
    "Highest cophenetic correlation is {}, which is obtained with {} linkage.".format(
        high_cophenet_corr, high_dm_lm[1]
    )
)
Cophenetic correlation for single linkage is 0.9232271494002922.
Cophenetic correlation for complete linkage is 0.7873280186580672.
Cophenetic correlation for average linkage is 0.9422540609560814.
Cophenetic correlation for weighted linkage is 0.8693784298129404.
****************************************************************************************************
Highest cophenetic correlation is 0.9422540609560814, which is obtained with average linkage.

Let's view the dendrograms for the different linkage methods with Euclidean distance.

Checking Dendrograms¶

Estimated runtime around: ~17.9-28.1 s

In [197]:
# list of linkage methods
linkage_methods = ["single", "complete", "average", "centroid", "ward", "weighted"] ## Complete the code to add linkages

# lists to save results of cophenetic correlation calculation
compare_cols = ["Linkage", "Cophenetic Coefficient"]
compare = []

# to create a subplot image
fig, axs = plt.subplots(len(linkage_methods), 1, figsize=(15, 30))

# We will enumerate through the list of linkage methods above
# For each linkage method, we will plot the dendrogram and calculate the cophenetic correlation
for i, method in enumerate(linkage_methods):
    Z = linkage(hc_df, metric="euclidean", method=method)

    dendrogram(Z, ax=axs[i])
    axs[i].set_title(f"Dendrogram ({method.capitalize()} Linkage)")

    coph_corr, coph_dist = cophenet(Z, pdist(hc_df))
    axs[i].annotate(
        f"Cophenetic\nCorrelation\n{coph_corr:0.2f}",
        (0.80, 0.80),
        xycoords="axes fraction",
    )

    compare.append([method, coph_corr])
In [198]:
# create and print a dataframe to compare cophenetic correlations for different linkage methods
df_cc = pd.DataFrame(compare, columns=compare_cols)
df_cc = df_cc.sort_values(by="Cophenetic Coefficient")
df_cc
Out[198]:
Linkage Cophenetic Coefficient
4 ward 0.710118
1 complete 0.787328
5 weighted 0.869378
0 single 0.923227
3 centroid 0.931401
2 average 0.942254

Creating model using sklearn¶

abbreviation: hc = hierarchical clustering

reference: Hierarchical clustering

In [199]:
HCmodel = AgglomerativeClustering(n_clusters=1, affinity='euclidean', linkage='ward')  ## Complete the code to define the hierarchical clustering model
HCmodel.fit(hc_df)
Out[199]:
AgglomerativeClustering(affinity='euclidean', n_clusters=1)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
AgglomerativeClustering(affinity='euclidean', n_clusters=1)
In [200]:
# creating a copy of the original data
df2 = df.copy()

# adding hierarchical cluster labels to the original and scaled dataframes
hc_df["HC_segments"] = HCmodel.labels_
df2["HC_segments"] = HCmodel.labels_

Cluster Profiling¶

error: TypeError: Could not convert to numeric

In [201]:
df2.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 340 entries, 0 to 339
Data columns (total 16 columns):
 #   Column                        Non-Null Count  Dtype  
---  ------                        --------------  -----  
 0   Ticker Symbol                 340 non-null    object 
 1   Security                      340 non-null    object 
 2   GICS Sector                   340 non-null    object 
 3   GICS Sub Industry             340 non-null    object 
 4   Current Price                 340 non-null    float64
 5   Price Change                  340 non-null    float64
 6   Volatility                    340 non-null    float64
 7   ROE                           340 non-null    int64  
 8   Cash Ratio                    340 non-null    int64  
 9   Net Cash Flow                 340 non-null    int64  
 10  Net Income                    340 non-null    int64  
 11  Earnings Per Share            340 non-null    float64
 12  Estimated Shares Outstanding  340 non-null    float64
 13  P/E Ratio                     340 non-null    float64
 14  P/B Ratio                     340 non-null    float64
 15  HC_segments                   340 non-null    int64  
dtypes: float64(7), int64(5), object(4)
memory usage: 42.6+ KB
In [202]:
hc_cluster_profile = df2.groupby(["HC_segments", "Ticker Symbol", "Security", "GICS Sector", "GICS Sub Industry"]).mean()  ## Complete the code to groupby the cluster labels

groupby: ["HC_segments", "Ticker Symbol", "Security", "GICS Sector", "GICS Sub Industry"]

  • Hierarchical clustering segments
  • and 4 object column titles
  • passed as strings into list
  • passed into groupby

Debugging:¶

to fix bug:

no companies in groups / clusters when grouped by 'GICS Sub Industry',

(below, after large hc_cluster_profile output table below),

do not group by all object columns as well as by HC_segments

(that is Hierarchical Clustering segments)

object_list contains all object columns:

In [203]:
object_list
Out[203]:
['Ticker Symbol', 'Security', 'GICS Sector', 'GICS Sub Industry']
In [204]:
# hc_cluster_profile["count_in_each_segment"] = (
#     df2.groupby(["HC_segments", "Ticker Symbol", "Security", "GICS Sector", "GICS Sub Industry"])["Security"].count().values  ## Complete the code to groupby the cluster labels
# )
In [205]:
hc_cluster_profile["count_in_each_segment"] = (
    df2.groupby(["HC_segments", 'Ticker Symbol', 'Security', 'GICS Sector', "GICS Sub Industry"])["GICS Sub Industry"].count().values  ## Complete the code to groupby the cluster labels
)
In [206]:
# from ChatGPT3:

# Requests:
#  how to loop through dataframe which displays max highlighted in green so that output of all this stock exchange ticker data like pe ratio and pb ratio etc does not have to display like a thousand rows but rather only those rows with a max value in them
# regenerate code for all rows as there are more than pe and pb ratios
# exclude dtype obj cols
# adapt given that currently : hc_cluster_profile.style.highlight_max(color="lightgreen", axis=0)

# response test 1:

# function to highlight maximum values in numeric columns
# def highlight_max(s):
#     if np.issubdtype(s.dtype, np.number):
#         is_max = s == s.max()
#         return ['background-color: green' if v else '' for v in is_max]
#     else:
#         return ['' for _ in s]

# # highlight maximum values in numeric columns only
# numeric_cols = hc_cluster_profile.select_dtypes(include=np.number).columns.tolist()
# hc_cluster_profile.style.apply(highlight_max, subset=numeric_cols)

# filter

# above failed as whole dataframe printed

# response test 2:

# function to highlight maximum values in numeric columns
def highlight_max(s):
    if np.issubdtype(s.dtype, np.number):
        is_max = s == s.max()
        return ['background-color: green' if v else '' for v in is_max]
    else:
        return ['' for _ in s]

# highlight maximum values in numeric columns only
numeric_cols = hc_cluster_profile.select_dtypes(include=np.number).columns.tolist()
hc_cluster_profile.style.apply(highlight_max, subset=numeric_cols)

# filter DataFrame to show only rows with max value in any numeric column
max_values = hc_cluster_profile.loc[hc_cluster_profile[numeric_cols].idxmax().values]

# display filtered DataFrame
print("Rows with maximum values in any numeric column:")
print(max_values)
Rows with maximum values in any numeric column:
                                                                                                                Current Price   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                      
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail       1274.949951  \
            FSLR          First Solar Inc         Information Technology Semiconductors                             65.989998   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production          7.110000   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production         44.470001   
            FB            Facebook                Information Technology Internet Software & Services              104.660004   
            BAC           Bank of America Corp    Financials             Banks                                      16.830000   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                      66.029999   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail       1274.949951   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                            32.279999   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail        675.890015   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services     276.570007   
            AAL           American Airlines Group Industrials            Airlines                                   42.349998   

                                                                                                                Price Change   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                     
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail         3.190527  \
            FSLR          First Solar Inc         Information Technology Semiconductors                            55.051683   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production       -44.798137   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production        11.397804   
            FB            Facebook                Information Technology Internet Software & Services              16.224320   
            BAC           Bank of America Corp    Financials             Banks                                      8.440722   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                      8.033377   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail         3.190527   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                            3.130991   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail        32.268105   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services      6.189286   
            AAL           American Airlines Group Industrials            Airlines                                   9.999995   

                                                                                                                Volatility   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                   
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail       1.268340  \
            FSLR          First Solar Inc         Information Technology Semiconductors                           2.075216   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production       4.580042   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production       2.405408   
            FB            Facebook                Information Technology Internet Software & Services             1.320606   
            BAC           Bank of America Corp    Financials             Banks                                    1.418688   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                    1.130337   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail       1.268340   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                          1.238748   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail       1.460386   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services    1.116976   
            AAL           American Airlines Group Industrials            Airlines                                 1.687151   

                                                                                                                  ROE   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                              
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail      29.0  \
            FSLR          First Solar Inc         Information Technology Semiconductors                          10.0   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production     200.0   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production     917.0   
            FB            Facebook                Information Technology Internet Software & Services             8.0   
            BAC           Bank of America Corp    Financials             Banks                                    6.0   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                   10.0   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail      29.0   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                         11.0   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail       4.0   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services   30.0   
            AAL           American Airlines Group Industrials            Airlines                               135.0   

                                                                                                                Cash Ratio   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                   
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail          184.0  \
            FSLR          First Solar Inc         Information Technology Semiconductors                              190.0   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production            2.0   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production           80.0   
            FB            Facebook                Information Technology Internet Software & Services                958.0   
            BAC           Bank of America Corp    Financials             Banks                                        99.0   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                        99.0   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail          184.0   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                              79.0   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail           58.0   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services        25.0   
            AAL           American Airlines Group Industrials            Airlines                                     51.0   

                                                                                                                Net Cash Flow   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                      
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail     -1.671386e+09  \
            FSLR          First Solar Inc         Information Technology Semiconductors                         -3.552280e+08   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production     -3.800000e+07   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production      6.980000e+08   
            FB            Facebook                Information Technology Internet Software & Services            5.920000e+08   
            BAC           Bank of America Corp    Financials             Banks                                   2.076400e+10   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                  -7.341000e+09   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail     -1.671386e+09   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                         2.980000e+08   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail      1.333000e+09   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services   9.088500e+07   
            AAL           American Airlines Group Industrials            Airlines                               -6.040000e+08   

                                                                                                                  Net Income   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                     
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail     2.551360e+09  \
            FSLR          First Solar Inc         Information Technology Semiconductors                         5.464210e+08   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production    -4.556000e+09   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production    -2.352800e+10   
            FB            Facebook                Information Technology Internet Software & Services           3.669000e+09   
            BAC           Bank of America Corp    Financials             Banks                                  1.588800e+10   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                  2.444200e+10   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail     2.551360e+09   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                        6.960000e+09   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail     5.960000e+08   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services  5.965410e+08   
            AAL           American Airlines Group Industrials            Airlines                               7.610000e+09   

                                                                                                                Earnings Per Share   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                           
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail                  50.09  \
            FSLR          First Solar Inc         Information Technology Semiconductors                                       5.42   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production                  -6.07   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production                 -61.20   
            FB            Facebook                Information Technology Internet Software & Services                         1.31   
            BAC           Bank of America Corp    Financials             Banks                                                4.18   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                                6.05   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail                  50.09   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                                      1.13   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail                   1.28   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services                8.91   
            AAL           American Airlines Group Industrials            Airlines                                            11.39   

                                                                                                                Estimated Shares Outstanding   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                                     
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail                     5.093552e+07  \
            FSLR          First Solar Inc         Information Technology Semiconductors                                         1.008157e+08   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production                     4.021417e+08   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production                     3.844444e+08   
            FB            Facebook                Information Technology Internet Software & Services                           2.800763e+09   
            BAC           Bank of America Corp    Financials             Banks                                                  8.450695e+08   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                                  4.040000e+09   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail                     5.093552e+07   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                                        6.159292e+09   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail                     4.656250e+08   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services                  6.695185e+07   
            AAL           American Airlines Group Industrials            Airlines                                               6.681299e+08   

                                                                                                                 P/E Ratio   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                   
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail      25.453183  \
            FSLR          First Solar Inc         Information Technology Semiconductors                          12.175276   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production      93.089287   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production      93.089287   
            FB            Facebook                Information Technology Internet Software & Services            79.893133   
            BAC           Bank of America Corp    Financials             Banks                                   13.004785   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                   10.914049   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail      25.453183   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                         28.566371   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail     528.039074   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services   31.040405   
            AAL           American Airlines Group Industrials            Airlines                                 3.718174   

                                                                                                                 P/B Ratio   
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                   
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail      -1.052429  \
            FSLR          First Solar Inc         Information Technology Semiconductors                          22.563791   
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production       1.273530   
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production       4.970809   
            FB            Facebook                Information Technology Internet Software & Services             5.884467   
            BAC           Bank of America Corp    Financials             Banks                                   -0.938007   
            JPM           JPMorgan Chase & Co.    Financials             Banks                                   -1.886881   
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail      -1.052429   
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                         -4.213309   
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail       3.904430   
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services  129.064585   
            AAL           American Airlines Group Industrials            Airlines                                -8.784219   

                                                                                                                count_in_each_segment  
HC_segments Ticker Symbol Security                GICS Sector            GICS Sub Industry                                             
0           PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail                         1  
            FSLR          First Solar Inc         Information Technology Semiconductors                                             1  
            SWN           Southwestern Energy     Energy                 Oil & Gas Exploration & Production                         1  
            APA           Apache Corporation      Energy                 Oil & Gas Exploration & Production                         1  
            FB            Facebook                Information Technology Internet Software & Services                               1  
            BAC           Bank of America Corp    Financials             Banks                                                      1  
            JPM           JPMorgan Chase & Co.    Financials             Banks                                                      1  
            PCLN          Priceline.com Inc       Consumer Discretionary Internet & Direct Marketing Retail                         1  
            PFE           Pfizer Inc.             Health Care            Pharmaceuticals                                            1  
            AMZN          Amazon.com Inc          Consumer Discretionary Internet & Direct Marketing Retail                         1  
            ADS           Alliance Data Systems   Information Technology Data Processing & Outsourced Services                      1  
            AAL           American Airlines Group Industrials            Airlines                                                   1  
In [207]:
hc_cluster_profile.style.highlight_max(color="lightgreen", axis=0)
Out[207]:
          Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio count_in_each_segment
HC_segments Ticker Symbol Security GICS Sector GICS Sub Industry                        
0 AAL American Airlines Group Industrials Airlines 42.349998 9.999995 1.687151 135.000000 51.000000 -604000000.000000 7610000000.000000 11.390000 668129938.500000 3.718174 -8.784219 1
ABBV AbbVie Health Care Pharmaceuticals 59.240002 8.339433 2.197887 130.000000 77.000000 51000000.000000 5144000000.000000 3.150000 1633015873.000000 18.806350 -8.750068 1
ABT Abbott Laboratories Health Care Health Care Equipment 44.910000 11.301121 1.273646 21.000000 67.000000 938000000.000000 4423000000.000000 2.940000 1504421769.000000 15.275510 -0.394171 1
ADBE Adobe Systems Inc Information Technology Application Software 93.940002 13.977195 1.357679 9.000000 180.000000 -240840000.000000 629551000.000000 1.260000 499643650.800000 74.555557 4.199651 1
ADI Analog Devices, Inc. Information Technology Semiconductors 55.320000 -1.827858 1.701169 14.000000 272.000000 315120000.000000 696878000.000000 0.310000 2247993548.000000 178.451613 1.059810 1
ADM Archer-Daniels-Midland Co Consumer Staples Agricultural Products 36.680000 -12.017268 1.516493 10.000000 49.000000 -189000000.000000 1849000000.000000 2.990000 618394648.800000 12.267559 7.496831 1
ADS Alliance Data Systems Information Technology Data Processing & Outsourced Services 276.570007 6.189286 1.116976 30.000000 25.000000 90885000.000000 596541000.000000 8.910000 66951851.850000 31.040405 129.064585 1
AEE Ameren Corp Utilities MultiUtilities 43.230000 2.174424 1.124186 9.000000 14.000000 287000000.000000 636000000.000000 2.600000 244615384.600000 16.626923 -0.719497 1
AEP American Electric Power Utilities Electric Utilities 58.270000 2.371753 1.068485 11.000000 9.000000 13900000.000000 2052300000.000000 3.130000 421897810.200000 18.456543 -3.022649 1
AFL AFLAC Inc Financials Life & Health Insurance 59.900002 3.027181 1.048295 14.000000 99.000000 -308000000.000000 2533000000.000000 5.880000 430782312.900000 10.187075 -1.883912 1
AIG American International Group, Inc. Financials Property & Casualty Insurance 61.970001 8.358108 1.106965 2.000000 99.000000 -129000000.000000 2196000000.000000 1.690000 1299408284.000000 36.668640 -4.327138 1
AIV Apartment Investment & Mgmt Real Estate REITs 40.029999 7.578608 1.163334 15.000000 47.000000 21818000.000000 248710000.000000 1.520000 163625000.000000 26.335526 -1.269332 1
AIZ Assurant Inc Financials Multi-line Insurance 80.540001 1.897773 1.112604 3.000000 99.000000 -30351000.000000 141555000.000000 2.080000 68055288.460000 38.721154 -4.072615 1
AJG Arthur J. Gallagher & Co. Financials Insurance Brokers 40.939999 -0.606943 1.052050 10.000000 99.000000 166000000.000000 356800000.000000 2.070000 172367149.800000 19.777777 -9.855706 1
AKAM Akamai Technologies Inc Information Technology Internet Software & Services 52.630001 -23.790903 1.384502 10.000000 225.000000 50823000.000000 321406000.000000 1.800000 178558888.900000 29.238889 4.282358 1
ALB Albemarle Corp Materials Specialty Chemicals 56.009998 26.461948 1.974323 10.000000 13.000000 -2276034000.000000 334906000.000000 3.010000 111264451.800000 18.607973 -13.649723 1
ALK Alaska Air Group Inc Industrials Airlines 80.510002 2.066436 1.773431 35.000000 74.000000 -34000000.000000 848000000.000000 6.610000 128290469.000000 12.180031 -1.114658 1
ALL Allstate Corp Financials Property & Casualty Insurance 62.090000 6.592275 1.053266 11.000000 99.000000 -162000000.000000 2171000000.000000 5.120000 424023437.500000 12.126953 -4.327138 1
ALLE Allegion Industrials Building Products 65.919998 13.753230 1.283795 601.000000 45.000000 -90800000.000000 153900000.000000 1.600000 96187500.000000 41.199999 -0.877453 1
ALXN Alexion Pharmaceuticals Health Care Biotechnology 190.750000 22.338380 2.022921 2.000000 195.000000 66000000.000000 144000000.000000 0.680000 211764705.900000 280.514706 -14.171389 1
AMAT Applied Materials Inc Information Technology Semiconductor Equipment 18.670000 26.834239 1.460030 18.000000 131.000000 1795000000.000000 1377000000.000000 1.130000 1218584071.000000 16.522124 3.857756 1
AME AMETEK Inc Industrials Electrical Components & Equipment 53.590000 2.212474 1.089266 18.000000 37.000000 3390000.000000 590859000.000000 2.460000 240186585.400000 21.784553 -4.490342 1
AMG Affiliated Managers Group Inc Financials Asset Management & Custody Banks 159.759995 -6.611335 2.093065 18.000000 67.000000 13200000.000000 516000000.000000 9.490000 54373024.240000 16.834562 -31.015380 1
AMGN Amgen Inc Health Care Biotechnology 162.330002 17.163478 1.630259 25.000000 362.000000 413000000.000000 6939000000.000000 9.150000 758360655.700000 17.740984 24.012322 1
AMP Ameriprise Financial Financials Asset Management & Custody Banks 106.419998 -2.420686 1.222260 22.000000 67.000000 -281000000.000000 1562000000.000000 8.600000 181627907.000000 12.374418 -13.398380 1
AMT American Tower Corp A Real Estate Specialized REITs 96.949997 10.233087 1.165804 10.000000 39.000000 7194000.000000 685074000.000000 1.420000 482446478.900000 68.274646 -20.813577 1
AMZN Amazon.com Inc Consumer Discretionary Internet & Direct Marketing Retail 675.890015 32.268105 1.460386 4.000000 58.000000 1333000000.000000 596000000.000000 1.280000 465625000.000000 528.039074 3.904430 1
AN AutoNation Inc Consumer Discretionary Specialty Stores 59.660000 2.350316 1.480914 19.000000 1.000000 -1300000.000000 442600000.000000 3.930000 112620865.100000 15.180662 -7.970104 1
ANTM Anthem Inc. Health Care Managed Health Care 139.440002 -0.620053 1.511654 11.000000 70.000000 -38200000.000000 2560000000.000000 9.730000 263103802.700000 14.330935 -31.006773 1
AON Aon plc Financials Insurance Brokers 92.209999 3.910301 1.105032 23.000000 99.000000 10000000.000000 1385000000.000000 4.930000 280933062.900000 18.703854 -7.759856 1
APA Apache Corporation Energy Oil & Gas Exploration & Production 44.470001 11.397804 2.405408 917.000000 80.000000 698000000.000000 -23528000000.000000 -61.200000 384444444.400000 93.089287 4.970809 1
APC Anadarko Petroleum Corp Energy Oil & Gas Exploration & Production 48.580002 -20.802083 2.435165 52.000000 22.000000 -6430000000.000000 -6692000000.000000 -13.180000 507738998.500000 93.089287 -12.860938 1
APH Amphenol Corp Information Technology Electronic Components 52.230000 2.693667 1.007762 24.000000 175.000000 768300000.000000 763500000.000000 2.470000 309109311.700000 21.145749 8.202923 1
ARNC Arconic Inc Industrials Aerospace & Defense 7.398807 1.647784 2.592065 3.000000 37.000000 42000000.000000 -322000000.000000 -0.310000 1038709677.000000 18.687607 2.639814 1
ATVI Activision Blizzard Information Technology Home Entertainment Software 38.709999 23.319529 1.886335 11.000000 70.000000 -3025000000.000000 892000000.000000 1.210000 737190082.600000 31.991735 0.290291 1
AVB AvalonBay Communities, Inc. Real Estate Residential REITs 184.130005 4.857630 1.132875 8.000000 47.000000 -108953000.000000 741733000.000000 5.540000 133886823.100000 33.236463 -3.089477 1
AVGO Broadcom Information Technology Semiconductors 145.149994 17.902683 1.847180 29.000000 163.000000 218000000.000000 1364000000.000000 2.860000 1044055944.000000 18.249407 3.954975 1
AWK American Water Works Company Inc Utilities Water Utilities 59.750000 8.596874 1.171525 9.000000 4.000000 22000000.000000 476000000.000000 2.660000 178947368.400000 22.462406 -4.895294 1
AXP American Express Co Financials Consumer Finance 69.550003 -6.216290 0.900066 25.000000 99.000000 474000000.000000 5163000000.000000 3.900000 506660363.000000 10.263506 -0.609074 1
BA Boeing Company Industrials Aerospace & Defense 144.589996 10.105078 1.155905 82.000000 24.000000 -431000000.000000 5176000000.000000 7.520000 688297872.300000 19.227393 22.032612 1
BAC Bank of America Corp Financials Banks 16.830000 8.440722 1.418688 6.000000 99.000000 20764000000.000000 15888000000.000000 4.180000 845069512.200000 13.004785 -0.938007 1
BAX Baxter International Inc. Health Care Health Care Equipment 38.150002 16.702365 1.204526 11.000000 128.000000 -712000000.000000 968000000.000000 1.780000 543820224.700000 21.432585 8.637045 1
BBT BB&T Corporation Financials Banks 37.810001 5.940045 1.077678 8.000000 99.000000 1386000000.000000 2084000000.000000 2.590000 804633204.600000 14.598456 -0.852562 1
BCR Bard (C.R.) Inc. Health Care Health Care Equipment 189.440002 1.549182 1.394436 9.000000 82.000000 -9600000.000000 135400000.000000 1.800000 75222222.220000 105.244446 -4.127770 1
BHI Baker Hughes Inc Energy Oil & Gas Equipment & Services 46.150002 -12.312367 2.559553 12.000000 84.000000 584000000.000000 -1967000000.000000 -4.490000 438084632.500000 93.089287 13.490544 1
BIIB BIOGEN IDEC Inc. Health Care Biotechnology 306.350006 4.917982 1.825994 38.000000 133.000000 148900000.000000 3547000000.000000 15.380000 230624187.300000 19.918726 0.162602 1
BK The Bank of New York Mellon Corp. Financials Banks 41.220001 5.422003 1.201660 8.000000 99.000000 -433000000.000000 3158000000.000000 2.730000 1156776557.000000 15.098901 -3.321298 1
BLL Ball Corp Materials Metal & Glass Containers 72.730003 16.535816 1.386684 22.000000 10.000000 32600000.000000 280900000.000000 2.050000 137024390.200000 35.478050 -3.895657 1
BMY Bristol-Myers Squibb Health Care Health Care Distributors 68.790001 16.081680 1.498872 11.000000 53.000000 -3186000000.000000 1565000000.000000 0.940000 1664893617.000000 73.180852 0.588026 1
BSX Boston Scientific Health Care Health Care Equipment 18.440001 11.757582 1.491764 4.000000 13.000000 -268000000.000000 -239000000.000000 -0.180000 1327777778.000000 31.468962 -3.880921 1
BWA BorgWarner Consumer Discretionary Auto Parts & Equipment 43.230000 3.470563 2.058769 17.000000 25.000000 -220100000.000000 609700000.000000 2.720000 224154411.800000 15.893382 1.044815 1
BXP Boston Properties Real Estate REITs 127.540001 7.203497 1.089469 10.000000 47.000000 -1039361000.000000 583106000.000000 3.790000 153853825.900000 33.651715 -1.269332 1
C Citigroup Inc. Financials Banks 51.750000 4.714695 1.261984 8.000000 99.000000 -11208000000.000000 17242000000.000000 5.410000 3187060998.000000 9.565619 -1.167533 1
CAT Caterpillar Inc. Industrials Construction & Farm Machinery & Heavy Trucks 67.959999 3.550209 1.493553 17.000000 25.000000 -881000000.000000 2512000000.000000 3.540000 709604519.800000 19.197740 6.264053 1
CB Chubb Limited Financials Property & Casualty Insurance 116.849998 13.193834 0.944847 10.000000 99.000000 1120000000.000000 2834000000.000000 8.710000 325373134.300000 13.415614 -17.466101 1
CBG CBRE Group Real Estate Real Estate Services 34.580002 8.197757 1.297857 20.000000 12.000000 -200481000.000000 547132000.000000 1.640000 333617073.200000 21.085367 -3.415302 1
CCI Crown Castle International Corp. Real Estate REITs 86.449997 9.569068 0.960191 21.000000 36.000000 3190000.000000 1520992000.000000 4.440000 342565765.800000 19.470720 -10.666679 1
CCL Carnival Corp. Consumer Discretionary Hotels, Resorts & Cruise Lines 54.480000 8.938217 1.347239 7.000000 20.000000 1064000000.000000 1757000000.000000 2.260000 777433628.300000 24.106195 -7.477166 1
CELG Celgene Corp. Health Care Biotechnology 119.760002 8.448793 2.000828 27.000000 333.000000 758700000.000000 1602000000.000000 2.020000 793069306.900000 59.287130 -4.320051 1
CF CF Industries Holdings Inc Materials Fertilizers & Agricultural Chemicals 40.810001 -9.250611 2.368186 16.000000 25.000000 -1710600000.000000 664900000.000000 2.970000 223872053.900000 13.740741 -0.393528 1
CFG Citizens Financial Group Financials Regional Banks 26.190001 10.273688 1.189236 4.000000 99.000000 -191000000.000000 840000000.000000 1.550000 541935483.900000 16.896775 -0.063096 1
CHD Church & Dwight Consumer Staples Household Products 42.439999 1.047615 0.929026 20.000000 38.000000 -93000000.000000 410400000.000000 3.130000 131118210.900000 13.559105 -9.428134 1
CHK Chesapeake Energy Energy Integrated Oil & Gas 4.500000 -38.101788 4.559815 687.000000 22.000000 -3283000000.000000 -14685000000.000000 -22.430000 654703522.100000 28.407929 -1.840528 1
CHRW C. H. Robinson Worldwide Industrials Air Freight & Logistics 62.020000 -9.008221 1.185473 44.000000 12.000000 39289000.000000 509699000.000000 3.520000 144800852.300000 17.619318 1.117804 1
CHTR Charter Communications Consumer Discretionary Cable & Satellite 183.100006 3.598507 1.697942 589.000000 0.000000 2000000.000000 -271000000.000000 -2.430000 111522633.700000 20.819876 -76.119077 1
CI CIGNA Corp. Health Care Managed Health Care 146.330002 8.682415 1.588398 17.000000 70.000000 548000000.000000 2094000000.000000 8.170000 256303549.600000 17.910649 -8.805281 1
CINF Cincinnati Financial Financials Property & Casualty Insurance 59.169998 9.777358 0.935812 10.000000 99.000000 -47000000.000000 634000000.000000 3.870000 163824289.400000 15.289405 -4.327138 1
CL Colgate-Palmolive Consumer Staples Household Products 66.620003 4.781379 0.895471 463.000000 27.000000 -119000000.000000 1384000000.000000 1.530000 904575163.400000 43.542486 -0.548324 1
CMA Comerica Inc. Financials Regional Banks 41.830002 1.900129 1.557655 7.000000 99.000000 76000000.000000 521000000.000000 2.930000 177815699.700000 14.276451 -0.063096 1
CME CME Group Inc. Financials Financial Exchanges & Data 90.599998 -2.402245 1.323348 6.000000 99.000000 326500000.000000 1247000000.000000 3.710000 336118598.400000 24.420485 -58.649536 1
CMG Chipotle Mexican Grill Consumer Discretionary Restaurants 479.850006 -33.131268 2.474002 22.000000 237.000000 -171460000.000000 475602000.000000 15.300000 31085098.040000 31.362745 17.201329 1
CMI Cummins Inc. Industrials Industrial Machinery 88.010002 -18.884791 1.472364 19.000000 48.000000 -590000000.000000 1399000000.000000 7.860000 177989821.900000 11.197201 21.439428 1
CMS CMS Energy Utilities MultiUtilities 36.080002 1.949712 1.037844 14.000000 12.000000 39000000.000000 537000000.000000 1.900000 282631578.900000 18.989475 0.063687 1
CNC Centene Corporation Health Care Managed Health Care 65.809998 21.712591 2.298696 16.000000 70.000000 150000000.000000 355000000.000000 2.990000 118729097.000000 22.010033 -1.305493 1
CNP CenterPoint Energy Utilities MultiUtilities 18.360001 1.436470 1.389867 20.000000 43.000000 -34000000.000000 -692000000.000000 -1.610000 429813664.600000 17.313076 0.516503 1
COF Capital One Financial Financials Consumer Finance 72.180000 -0.619575 1.364592 9.000000 99.000000 781000000.000000 4050000000.000000 7.150000 566433566.400000 10.095105 -0.725643 1
COG Cabot Oil & Gas Energy Oil & Gas Exploration & Production 17.690001 -20.099360 3.055818 6.000000 0.000000 -20440000.000000 -113891000.000000 -0.280000 406753571.400000 93.089287 -0.223147 1
COO The Cooper Companies Health Care Health Care Supplies 134.199997 -9.672215 1.555057 8.000000 3.000000 -8796000.000000 203523000.000000 1.790000 140335195.500000 33.994412 0.855096 1
CSX CSX Corp. Industrials Railroads 25.950001 -4.349421 1.626219 17.000000 74.000000 -41000000.000000 1968000000.000000 2.000000 984000000.000000 12.975001 0.902439 1
CTL CenturyLink Inc Telecommunications Services Integrated Telecommunications Services 25.160000 0.159232 1.522194 6.000000 3.000000 -2000000.000000 878000000.000000 1.580000 555696202.500000 15.924051 -13.383212 1
CTSH Cognizant Technology Solutions Information Technology IT Consulting & Other Services 60.020000 -4.654489 1.338123 17.000000 182.000000 115100000.000000 1623600000.000000 2.670000 608089887.600000 22.479401 7.121644 1
CTXS Citrix Systems Information Technology Internet Software & Services 75.650002 9.021477 1.968864 16.000000 52.000000 108369000.000000 319361000.000000 2.010000 158886069.700000 37.636817 -1.765013 1
CVS CVS Health Consumer Staples Drug Retail 97.769997 1.326561 1.487367 14.000000 11.000000 -22000000.000000 5237000000.000000 4.660000 1123819742.000000 20.980686 -7.019809 1
CVX Chevron Corp. Energy Integrated Oil & Gas 89.959999 12.844955 1.750655 3.000000 43.000000 -1763000000.000000 4587000000.000000 2.460000 1864634146.000000 36.569105 4.763937 1
CXO Concho Resources Energy Oil & Gas Exploration & Production 92.860001 -2.744032 2.692546 1.000000 38.000000 228529000.000000 65900000.000000 0.540000 122037037.000000 171.962965 5.673991 1
D Dominion Resources Utilities Electric Utilities 67.639999 -3.988642 0.889931 15.000000 8.000000 289000000.000000 1899000000.000000 3.210000 591588785.000000 21.071651 -7.604945 1
DAL Delta Air Lines Industrials Airlines 50.689999 13.375084 1.444219 42.000000 31.000000 -116000000.000000 4526000000.000000 5.680000 796830985.900000 8.924296 -16.730022 1
DD Du Pont (E.I.) Materials Diversified Chemicals 66.599998 37.489677 1.577881 20.000000 60.000000 -1610000000.000000 1953000000.000000 2.170000 900000000.000000 30.691243 3.252222 1
DE Deere & Co. Industrials Construction & Farm Machinery & Heavy Trucks 76.269997 3.952561 1.551946 29.000000 22.000000 375200000.000000 1940000000.000000 4.030000 532235888.200000 14.842233 6.277287 1
DFS Discover Financial Services Financials Consumer Finance 53.619999 3.653584 1.159897 20.000000 99.000000 2288000000.000000 2297000000.000000 5.140000 446887159.500000 10.431906 -0.375934 1
DGX Quest Diagnostics Health Care Health Care Facilities 71.139999 15.674795 1.381490 15.000000 11.000000 -59000000.000000 709000000.000000 4.920000 144105691.100000 14.459349 -4.552214 1
DHR Danaher Corp. Industrials Industrial Conglomerates 70.416985 8.924595 1.191466 14.000000 13.000000 -2214800000.000000 3357400000.000000 4.810000 698004158.000000 14.639706 -13.759230 1
DIS The Walt Disney Company Consumer Discretionary Broadcasting & Cable TV 105.080002 2.049141 1.188454 19.000000 26.000000 848000000.000000 8382000000.000000 4.950000 1693333333.000000 21.228283 -3.985039 1
DISCA Discovery Communications-A Consumer Discretionary Cable & Satellite 26.680000 2.026769 1.689235 19.000000 25.000000 23000000.000000 1034000000.000000 -2.430000 111522633.700000 20.819876 -76.119077 1
DISCK Discovery Communications-C Consumer Discretionary Cable & Satellite 25.219999 3.572891 1.812144 19.000000 25.000000 23000000.000000 1034000000.000000 -2.430000 111522633.700000 20.819876 -76.119077 1
DLPH Delphi Automotive Consumer Discretionary Auto Parts & Equipment 85.730003 12.109326 1.440884 64.000000 14.000000 -325000000.000000 1450000000.000000 5.080000 285433070.900000 16.875985 -0.662152 1
DLR Digital Realty Trust Real Estate Specialized REITs 75.620003 15.573900 1.070406 7.000000 39.000000 22239000.000000 296689000.000000 1.560000 190185256.400000 48.474361 -7.489313 1
DNB Dun & Bradstreet Industrials Research & Consulting Services 103.930000 -1.188439 1.337924 15.000000 38.000000 46300000.000000 168800000.000000 4.680000 36068376.070000 22.207265 -11.877441 1
DOV Dover Corp. Industrials Industrial Machinery 61.310001 6.979585 1.507569 24.000000 26.000000 -319396000.000000 869829000.000000 5.520000 157577717.400000 11.106884 -2.293440 1
DPS Dr Pepper Snapple Group Consumer Staples Soft Drinks 93.199997 18.049399 1.150797 35.000000 58.000000 683000000.000000 764000000.000000 4.000000 191000000.000000 23.299999 -12.717277 1
DUK Duke Energy Utilities Electric Utilities 71.389999 -0.833448 1.096727 7.000000 8.000000 -1179000000.000000 2816000000.000000 4.050000 695308642.000000 17.627160 -4.426811 1
DVA DaVita Inc. Health Care Health Care Facilities 69.709999 -3.622291 1.211643 6.000000 79.000000 533875000.000000 269732000.000000 1.270000 212387401.600000 54.889763 1.962527 1
DVN Devon Energy Corp. Energy Oil & Gas Exploration & Production 32.000000 -15.478079 2.923698 205.000000 70.000000 830000000.000000 -14454000000.000000 -35.550000 406582278.500000 93.089287 1.785616 1
EBAY eBay Inc. Information Technology Internet Software & Services 27.480000 12.163265 1.409302 26.000000 271.000000 -4496000000.000000 1725000000.000000 1.430000 1206293706.000000 19.216783 4.601699 1
ECL Ecolab Inc. Materials Specialty Chemicals 114.379997 3.783684 1.078516 15.000000 2.000000 -116800000.000000 1002100000.000000 3.380000 296479289.900000 33.840236 -14.928867 1
ED Consolidated Edison Utilities Electric Utilities 64.269997 -3.974306 1.068002 9.000000 20.000000 249000000.000000 1193000000.000000 4.070000 293120393.100000 15.791154 -3.022649 1
EFX Equifax Inc. Industrials Research & Consulting Services 111.370003 14.531063 1.081040 19.000000 15.000000 -35000000.000000 429100000.000000 3.610000 118864265.900000 30.850416 -8.116821 1
EIX Edison Int'l Utilities Electric Utilities 59.209999 -6.135071 0.927260 10.000000 3.000000 29000000.000000 1117000000.000000 3.130000 356869009.600000 18.916933 -6.369284 1
EMN Eastman Chemical Materials Diversified Chemicals 67.510002 3.654238 1.404508 22.000000 14.000000 79000000.000000 848000000.000000 5.710000 148511383.500000 11.823118 -12.308821 1
EOG EOG Resources Energy Oil & Gas Exploration & Production 70.790001 -4.078593 1.941104 35.000000 39.000000 -1368707000.000000 -4524515000.000000 -8.290000 545779855.200000 93.089287 1.416243 1
EQIX Equinix Real Estate REITs 302.399994 10.019650 1.308082 7.000000 164.000000 1617921000.000000 187774000.000000 3.250000 57776615.380000 93.046152 23.856728 1
EQR Equity Residential Real Estate REITs 81.589996 8.037605 1.056186 8.000000 47.000000 2196000.000000 870120000.000000 2.370000 367139240.500000 34.426159 -1.269332 1
EQT EQT Corporation Energy Oil & Gas Exploration & Production 52.130001 -21.253771 2.364883 2.000000 201.000000 523803000.000000 85171000.000000 0.560000 152091071.400000 93.089287 9.567952 1
ES Eversource Energy Utilities MultiUtilities 51.070000 0.709921 1.232829 8.000000 1.000000 -14756000.000000 878485000.000000 2.770000 317142599.300000 18.436823 -1.169833 1
ESS Essex Property Trust, Inc. Real Estate Residential REITs 239.410004 6.765073 1.118425 4.000000 47.000000 4073000.000000 232120000.000000 3.500000 66320000.000000 68.402858 -3.089477 1
ETFC E*Trade Financials Investment Banking & Brokerage 29.639999 12.656785 1.452048 5.000000 99.000000 450000000.000000 268000000.000000 0.920000 291304347.800000 32.217390 -0.597313 1
ETN Eaton Corporation Industrials Industrial Conglomerates 52.040001 1.166411 1.521430 13.000000 10.000000 -513000000.000000 1979000000.000000 4.250000 465647058.800000 12.244706 -8.639591 1
ETR Entergy Corp. Utilities Electric Utilities 68.360001 4.910983 1.217401 2.000000 44.000000 -71065000.000000 -156734000.000000 -0.990000 158317171.700000 18.456543 6.174024 1
EW Edwards Lifesciences Health Care Health Care Equipment 78.980003 11.616734 1.666482 20.000000 257.000000 64600000.000000 494900000.000000 2.300000 215173913.000000 34.339132 6.349747 1
EXC Exelon Corp. Utilities MultiUtilities 27.770000 -6.403775 1.351595 9.000000 74.000000 4624000000.000000 2269000000.000000 2.685000 299887089.100000 17.313076 -1.715880 1
EXPD Expeditors Int'l Industrials Air Freight & Logistics 45.099998 -4.449159 1.062553 27.000000 94.000000 -119311000.000000 457223000.000000 2.420000 188935124.000000 18.636363 5.991459 1
EXPE Expedia Inc. Consumer Discretionary Internet & Direct Marketing Retail 124.300003 4.894517 1.578747 16.000000 29.000000 273599000.000000 764465000.000000 5.870000 130232538.300000 21.175469 -44.103494 1
EXR Extra Space Storage Real Estate Specialized REITs 88.209999 13.922251 1.186059 19.000000 39.000000 28136000.000000 394950000.000000 1.580000 249968354.400000 55.829113 -14.151445 1
F Ford Motor Consumer Discretionary Automobile Manufacturers 14.090000 2.398256 1.151454 26.000000 43.000000 3515000000.000000 7373000000.000000 1.860000 3963978495.000000 7.575269 5.108756 1
FAST Fastenal Co Industrials Building Products 40.820000 10.984234 1.411396 29.000000 35.000000 14523000.000000 516361000.000000 1.770000 291729378.500000 23.062147 4.427425 1
FB Facebook Information Technology Internet Software & Services 104.660004 16.224320 1.320606 8.000000 958.000000 592000000.000000 3669000000.000000 1.310000 2800763359.000000 79.893133 5.884467 1
FBHS Fortune Brands Home & Security Industrials Building Products 55.500000 16.817517 1.348297 13.000000 31.000000 46600000.000000 315000000.000000 1.970000 159898477.200000 28.172589 -2.100708 1
FCX Freeport-McMoran Cp & Gld Materials Copper 6.770000 -31.685167 3.796410 155.000000 5.000000 -240000000.000000 -12156000000.000000 -11.310000 1074801061.000000 22.811951 2.935427 1
FE FirstEnergy Corp Utilities Electric Utilities 31.730000 1.179844 1.238785 5.000000 2.000000 46000000.000000 578000000.000000 1.370000 421897810.200000 23.160584 -6.072561 1
FIS Fidelity National Information Services Information Technology Internet Software & Services 60.599998 -10.553508 1.148295 7.000000 29.000000 194800000.000000 650800000.000000 2.220000 293153153.200000 27.297296 -19.086610 1
FISV Fiserv Inc Information Technology Internet Software & Services 91.459999 5.235295 0.904487 27.000000 18.000000 -19000000.000000 712000000.000000 3.040000 234210526.300000 30.085526 -7.975730 1
FLIR FLIR Systems Information Technology Electronic Equipment & Instruments 28.070000 0.214209 1.761193 15.000000 81.000000 -58589000.000000 241686000.000000 1.730000 139702890.200000 16.225434 4.014713 1
FLR Fluor Corp. Industrials Diversified Commercial Services 47.220001 10.819056 1.774454 14.000000 73.000000 -43239000.000000 412512000.000000 2.850000 144741052.600000 16.568421 14.992623 1
FLS Flowserve Corporation Industrials Industrial Machinery 42.080002 2.210357 1.781661 16.000000 27.000000 -83906000.000000 267669000.000000 2.010000 133168656.700000 20.935324 6.746760 1
FMC FMC Corporation Materials Diversified Chemicals 39.130001 15.088238 2.175738 26.000000 5.000000 -30900000.000000 489000000.000000 3.660000 133606557.400000 10.691257 5.101546 1
FRT Federal Realty Investment Trust Real Estate Retail REITs 146.100006 6.806063 1.239858 13.000000 47.000000 -26905000.000000 210219000.000000 3.040000 69150986.840000 48.059213 -3.973395 1
FSLR First Solar Inc Information Technology Semiconductors 65.989998 55.051683 2.075216 10.000000 190.000000 -355228000.000000 546421000.000000 5.420000 100815682.700000 12.175276 22.563791 1
FTR Frontier Communications Telecommunications Services Integrated Telecommunications Services 4.670000 -2.301255 2.026818 3.000000 496.000000 254000000.000000 -196000000.000000 -0.290000 675862069.000000 14.518987 10.497704 1
GD General Dynamics Industrials Aerospace & Defense 137.360001 -0.463767 0.939544 28.000000 22.000000 -1603000000.000000 2965000000.000000 9.230000 321235102.900000 14.881907 4.242998 1
GGP General Growth Properties Inc. Real Estate Retail REITs 27.209999 4.212937 1.390342 17.000000 47.000000 -15576000.000000 1374561000.000000 3.040000 158299350.600000 47.366973 -3.973395 1
GILD Gilead Sciences Health Care Biotechnology 101.190002 2.689264 1.494060 98.000000 148.000000 2824000000.000000 18108000000.000000 12.370000 1463864188.000000 8.180275 3.159446 1
GLW Corning Inc. Information Technology Electronic Components 18.280001 6.588927 1.578483 7.000000 163.000000 -809000000.000000 1339000000.000000 1.020000 1312745098.000000 17.921570 3.617610 1
GM General Motors Consumer Discretionary Automobile Manufacturers 34.009998 12.281271 1.344514 24.000000 33.000000 -3857000000.000000 9687000000.000000 6.110000 1585433715.000000 5.566284 -4.892037 1
GPC Genuine Parts Consumer Discretionary Specialty Stores 85.889999 4.033432 1.177027 22.000000 5.000000 73901000.000000 705672000.000000 4.650000 151757419.400000 18.470968 7.205242 1
GRMN Garmin Ltd. Consumer Discretionary Consumer Electronics 37.169998 3.393594 1.665475 14.000000 121.000000 -363198000.000000 456227000.000000 2.390000 190889958.200000 15.552300 5.760057 1
GT Goodyear Tire & Rubber Consumer Discretionary Tires & Rubber 32.669998 10.446241 1.522778 8.000000 30.000000 -685000000.000000 307000000.000000 1.140000 269298245.600000 28.657893 3.835896 1
GWW Grainger (W.W.) Inc. Industrials Industrial Materials 202.589996 -5.336199 1.348597 34.000000 16.000000 63492000.000000 768996000.000000 11.690000 65782378.100000 17.330196 12.112879 1
HAL Halliburton Co. Energy Oil & Gas Equipment & Services 34.040001 -5.101751 1.966062 4.000000 189.000000 7786000000.000000 -671000000.000000 -0.790000 849367088.600000 93.089287 17.345857 1
HAS Hasbro Inc. Consumer Discretionary Leisure Products 67.360001 -7.076834 1.583355 27.000000 92.000000 83583000.000000 451838000.000000 3.610000 125162880.900000 18.659280 12.145326 1
HBAN Huntington Bancshares Financials Banks 11.060000 4.143126 1.337793 11.000000 99.000000 -373409000.000000 692957000.000000 0.820000 845069512.200000 13.487805 -0.065057 1
HCA HCA Holdings Health Care Health Care Facilities 67.629997 -12.532337 1.914907 28.000000 13.000000 175000000.000000 2129000000.000000 5.140000 414202334.600000 13.157587 -7.279051 1
HCN Welltower Inc. Real Estate REITs 68.029999 0.044116 1.341731 6.000000 47.000000 -112818000.000000 849073000.000000 2.350000 361307659.600000 28.948936 -3.738047 1
HCP HCP Inc. Real Estate REITs 34.826959 2.218658 1.282286 6.000000 47.000000 162690000.000000 -559235000.000000 -1.210000 462177686.000000 33.651715 -1.269332 1
HES Hess Corporation Energy Integrated Oil & Gas 48.480000 -4.585713 2.398580 16.000000 103.000000 272000000.000000 -3056000000.000000 -10.780000 283487940.600000 28.407929 6.264817 1
HIG Hartford Financial Svc.Gp. Financials Property & Casualty Insurance 43.459999 -5.005467 1.147332 10.000000 99.000000 49000000.000000 1682000000.000000 4.050000 415308642.000000 10.730864 -4.327138 1
HOG Harley-Davidson Consumer Discretionary Motorcycle Manufacturers 45.389999 -17.247036 1.560372 41.000000 31.000000 -184471000.000000 752207000.000000 3.710000 202751212.900000 12.234501 6.069389 1
HON Honeywell Int'l Inc. Industrials Industrial Conglomerates 103.570000 9.320247 1.103449 26.000000 41.000000 -1504000000.000000 4768000000.000000 6.110000 780360065.500000 16.950900 -3.709826 1
HPE Hewlett Packard Enterprise Information Technology Technology Hardware, Storage & Peripherals 15.200000 -17.837838 3.400491 7.000000 45.000000 7523000000.000000 2461000000.000000 1.800000 513987730.100000 25.309524 3.954975 1
HPQ HP Inc. Information Technology Computer Hardware 11.840000 2.161759 2.373359 16.000000 18.000000 2300000000.000000 4554000000.000000 1.800000 513987730.100000 25.309524 3.954975 1
HRL Hormel Foods Corp. Consumer Staples Packaged Foods & Meats 39.540001 24.496225 1.078455 17.000000 29.000000 13065000.000000 686088000.000000 3.280000 199237804.900000 24.070121 -1.980483 1
HSIC Henry Schein Health Care Health Care Distributors 158.190002 18.317132 1.013922 17.000000 3.000000 -17388000.000000 479058000.000000 5.780000 82882006.920000 27.368512 5.925677 1
HST Host Hotels & Resorts Real Estate REITs 15.340000 -3.217666 1.594628 8.000000 47.000000 -445000000.000000 558000000.000000 0.220000 2536363636.000000 69.727273 -0.113548 1
HSY The Hershey Company Consumer Staples Packaged Foods & Meats 89.269997 -3.261814 1.188383 51.000000 16.000000 -28325000.000000 512951000.000000 3.280000 199237804.900000 24.070121 -1.980483 1
HUM Humana Inc. Health Care Managed Health Care 178.509995 -0.145443 1.615206 12.000000 70.000000 636000000.000000 1276000000.000000 8.540000 149414519.900000 20.902810 -8.805281 1
IBM International Business Machines Information Technology IT Consulting & Other Services 137.619995 -5.292136 1.082881 92.000000 24.000000 -790000000.000000 13190000000.000000 13.480000 978486646.900000 10.209198 4.852391 1
IDXX IDEXX Laboratories Health Care Health Care Equipment 72.919998 -1.565880 1.469586 228.000000 40.000000 -193542000.000000 192078000.000000 2.070000 92791304.350000 35.227052 -0.981083 1
IFF Intl Flavors & Fragrances Materials Specialty Chemicals 119.639999 14.961083 1.152855 26.000000 25.000000 -296585000.000000 419247000.000000 5.190000 80779768.790000 23.052023 5.047700 1
INTC Intel Corp. Information Technology Semiconductors 34.450001 14.035095 1.226022 19.000000 162.000000 12747000000.000000 11420000000.000000 2.410000 4738589212.000000 14.294606 3.954975 1
IP International Paper Materials Paper Packaging 37.700001 -0.026513 1.301630 24.000000 27.000000 -831000000.000000 938000000.000000 2.250000 416888888.900000 16.755556 6.123934 1
IPG Interpublic Group Consumer Discretionary Advertising 23.280001 21.821035 1.139799 23.000000 20.000000 -157700000.000000 454600000.000000 1.110000 409549549.600000 20.972974 0.265658 1
IRM Iron Mountain Incorporated Real Estate REITs 27.010000 -13.067267 1.301382 24.000000 15.000000 2448000.000000 123241000.000000 0.580000 212484482.800000 46.568966 -2.763651 1
ISRG Intuitive Surgical Inc. Health Care Health Care Equipment 546.159973 18.733013 1.126009 14.000000 317.000000 114300000.000000 588800000.000000 15.870000 37101449.280000 34.414617 42.607500 1
ITW Illinois Tool Works Industrials Industrial Machinery 92.680000 12.776831 1.142869 36.000000 130.000000 -900000000.000000 1899000000.000000 5.160000 368023255.800000 17.961240 7.586477 1
IVZ Invesco Ltd. Financials Asset Management & Custody Banks 33.480000 7.067477 1.580839 12.000000 67.000000 412000000.000000 968100000.000000 2.260000 428362831.900000 14.814159 4.218620 1
JBHT J. B. Hunt Transport Services Industrials Trucking 73.360001 2.961405 1.218373 33.000000 1.000000 -395000.000000 427235000.000000 3.690000 115781842.800000 19.880759 2.823845 1
JEC Jacobs Engineering Group Industrials Industrial Conglomerates 41.950001 11.539484 1.732990 7.000000 23.000000 -271788000.000000 302971000.000000 2.420000 125194628.100000 17.334711 6.294943 1
JNPR Juniper Networks Information Technology Networking Equipment 27.600000 7.351229 1.841767 14.000000 108.000000 -218700000.000000 633700000.000000 1.620000 391172839.500000 17.037037 2.752236 1
JPM JPMorgan Chase & Co. Financials Banks 66.029999 8.033377 1.130337 10.000000 99.000000 -7341000000.000000 24442000000.000000 6.050000 4040000000.000000 10.914049 -1.886881 1
KIM Kimco Realty Real Estate REITs 26.459999 8.709938 1.224688 18.000000 47.000000 2212000.000000 894115000.000000 2.010000 444833333.300000 13.164179 -1.269332 1
KMB Kimberly-Clark Consumer Staples Household Products 127.300003 17.511309 0.870405 582.000000 10.000000 -170000000.000000 1013000000.000000 2.780000 364388489.200000 45.791368 -2.533011 1
KMI Kinder Morgan Energy Oil & Gas Refining & Marketing & Transportation 14.920000 -47.129693 3.139352 1.000000 7.000000 -86000000.000000 253000000.000000 0.100000 2530000000.000000 149.200000 -1.894071 1
KO Coca Cola Company Consumer Staples Soft Drinks 42.959999 6.812526 0.889913 29.000000 74.000000 -1649000000.000000 7351000000.000000 1.690000 4349704142.000000 25.420118 -1.466307 1
KSU Kansas City Southern Industrials Railroads 74.669998 -18.438017 2.071639 12.000000 18.000000 -211400000.000000 483500000.000000 4.410000 109637188.200000 16.931972 -2.012091 1
LEG Leggett & Platt Industrials Industrial Conglomerates 42.020000 1.965545 1.204037 30.000000 36.000000 -79600000.000000 329200000.000000 2.310000 142510822.500000 18.190476 2.931005 1
LEN Lennar Corp. Consumer Discretionary Homebuilding 48.910000 1.705136 1.569167 14.000000 25.000000 -123369000.000000 802894000.000000 3.870000 207466149.900000 12.638243 -0.307832 1
LH Laboratory Corp. of America Holding Health Care Health Care Facilities 123.639999 14.174899 1.603130 9.000000 42.000000 136400000.000000 436900000.000000 5.030000 178246546.300000 15.900937 -1.294844 1
LKQ LKQ Corporation Consumer Discretionary Distributors 29.629999 4.441304 1.427237 14.000000 12.000000 -27208000.000000 423223000.000000 3.030000 213598256.500000 20.819876 -0.857290 1
LLL L-3 Communications Holdings Industrials Industrial Conglomerates 119.510002 14.539013 1.513434 6.000000 7.000000 -235000000.000000 -240000000.000000 -2.970000 80808080.810000 17.334711 14.280750 1
LLY Lilly (Eli) & Co. Health Care Pharmaceuticals 84.260002 0.789478 1.440622 17.000000 54.000000 -205200000.000000 2408400000.000000 2.270000 1060969163.000000 37.118944 -0.651103 1
LMT Lockheed Martin Corp. Industrials Aerospace & Defense 217.149994 5.254227 0.903098 116.000000 8.000000 -356000000.000000 3605000000.000000 11.620000 310240963.900000 18.687607 -10.852854 1
LNT Alliant Energy Corp Utilities Electric Utilities 31.225001 6.642759 1.115842 10.000000 0.000000 -51100000.000000 388400000.000000 3.360000 115595238.100000 9.293155 -4.606591 1
LUK Leucadia National Corp. Financials Multi-Sector Holdings 17.389999 -14.292764 1.554235 2.000000 81.000000 -638127000.000000 252111000.000000 0.740000 340690540.500000 23.499999 19.821416 1
LUV Southwest Airlines Industrials Airlines 43.060001 13.855106 1.536290 30.000000 41.000000 301000000.000000 2181000000.000000 3.300000 660909090.900000 13.048485 -5.117194 1
LVLT Level 3 Communications Telecommunications Services Alternative Carriers 54.360001 24.707504 1.457013 34.000000 61.000000 274000000.000000 3433000000.000000 9.710000 353553038.100000 5.598352 -2.245773 1
LYB LyondellBasell Materials Diversified Chemicals 86.900002 2.573183 1.609745 68.000000 46.000000 -107000000.000000 4476000000.000000 9.620000 465280665.300000 9.033264 10.316354 1
MA Mastercard Inc. Information Technology Internet Software & Services 97.360001 7.496965 1.095876 63.000000 130.000000 610000000.000000 3808000000.000000 3.360000 1133333333.000000 28.976191 3.451765 1
MAA Mid-America Apartments Real Estate Residential REITs 90.809998 10.622490 1.177776 12.000000 47.000000 10906000.000000 350745000.000000 4.410000 79534013.610000 20.591836 -3.089477 1
MAC Macerich Real Estate Retail REITs 80.690002 4.183351 1.169328 10.000000 47.000000 1603000.000000 487562000.000000 3.080000 158299350.600000 26.198053 -3.973395 1
MAR Marriott Int'l. Consumer Discretionary Hotels, Resorts & Cruise Lines 67.040001 -1.973970 1.642450 24.000000 3.000000 -8000000.000000 859000000.000000 3.220000 266770186.300000 20.819876 -12.370198 1
MAS Masco Corp. Industrials Building Products 28.299999 11.637077 1.428359 263.000000 61.000000 85000000.000000 355000000.000000 1.030000 344660194.200000 27.475727 2.219577 1
MAT Mattel Inc. Consumer Discretionary Leisure Products 27.170000 30.625006 1.921708 14.000000 54.000000 -78836000.000000 369416000.000000 1.080000 342051851.900000 25.157407 4.535251 1
MCD McDonald's Corp. Consumer Discretionary Restaurants 118.139999 19.939085 0.733163 64.000000 260.000000 5607600000.000000 4529300000.000000 4.820000 939688796.700000 24.510373 7.122145 1
MCO Moody's Corp Financials Diversified Financial Services 100.339996 2.345976 1.268800 167.000000 183.000000 537900000.000000 941300000.000000 4.700000 200276595.700000 21.348935 8.615585 1
MDLZ Mondelez International Consumer Staples Packaged Foods & Meats 44.840000 6.079962 1.321548 26.000000 17.000000 239000000.000000 7267000000.000000 4.490000 1618485523.000000 9.986637 -12.809506 1
MET MetLife Inc. Financials Life & Health Insurance 48.209999 1.366690 1.138650 8.000000 99.000000 1944000000.000000 5310000000.000000 4.610000 1151843818.000000 10.457700 -1.883912 1
MHK Mohawk Industries Consumer Discretionary Home Furnishings 189.389999 3.514425 1.492478 13.000000 3.000000 -16185000.000000 615302000.000000 2.590000 237568339.800000 73.123552 -3.980316 1
MJN Mead Johnson Consumer Staples Packaged Foods & Meats 78.949997 12.081196 1.718403 103.000000 136.000000 403700000.000000 653500000.000000 3.280000 199237804.900000 24.070121 6.495755 1
MKC McCormick & Co. Consumer Staples Packaged Foods & Meats 85.559998 6.976738 1.032221 24.000000 9.000000 35300000.000000 401600000.000000 3.140000 127898089.200000 27.248407 -1.980483 1
MLM Martin Marietta Materials Materials Construction Materials 136.580002 -10.866015 2.164150 7.000000 46.000000 59758000.000000 288792000.000000 4.310000 67005104.410000 31.689096 3.050887 1
MMC Marsh & McLennan Financials Insurance Brokers 55.450001 6.022948 1.034162 25.000000 99.000000 -584000000.000000 1599000000.000000 3.010000 531229235.900000 18.421927 -1.950194 1
MMM 3M Company Industrials Industrial Conglomerates 150.639999 5.927847 0.982698 42.000000 27.000000 -99000000.000000 4833000000.000000 7.720000 626036269.400000 19.512953 2.023844 1
MNST Monster Beverage Consumer Staples Soft Drinks 49.653332 10.800357 1.585944 11.000000 568.000000 1805094000.000000 546733000.000000 3.710000 1469541779.000000 25.420118 -5.190734 1
MO Altria Group Inc Consumer Staples Tobacco 58.209999 6.885788 0.959008 182.000000 33.000000 -952000000.000000 5241000000.000000 2.670000 1962921348.000000 21.801498 -6.632971 1
MOS The Mosaic Company Materials Fertilizers & Agricultural Chemicals 27.590000 -11.229086 2.830675 10.000000 62.000000 -1098300000.000000 1000400000.000000 2.790000 358566308.200000 9.888889 5.846617 1
MPC Marathon Petroleum Energy Oil & Gas Refining & Marketing & Transportation 51.840000 11.507846 1.989371 22.000000 18.000000 -367000000.000000 2852000000.000000 5.290000 539130434.800000 9.799622 5.798226 1
MRK Merck & Co. Health Care Pharmaceuticals 52.820000 7.031413 1.278460 10.000000 70.000000 1083000000.000000 4442000000.000000 1.580000 2811392405.000000 33.430380 -4.282931 1
MRO Marathon Oil Corp. Energy Oil & Gas Exploration & Production 12.590000 -20.265991 3.325386 12.000000 71.000000 -1177000000.000000 -2204000000.000000 -3.260000 676073619.600000 93.089287 1.273530 1
MTB M&T Bank Corp. Financials Banks 121.180000 -0.361785 1.380390 7.000000 99.000000 -5317000.000000 1079667000.000000 7.220000 149538365.700000 16.783934 -0.938007 1
MTD Mettler Toledo Health Care Life Sciences Tools & Services 339.130005 18.942905 1.115376 61.000000 18.000000 13624000.000000 352820000.000000 12.750000 27672156.860000 26.598432 4.403994 1
MUR Murphy Oil Energy Integrated Oil & Gas 22.450001 -8.591197 2.851180 43.000000 27.000000 -910125000.000000 -2270833000.000000 -13.030000 174277283.200000 28.407929 -1.298006 1
MYL Mylan N.V. Health Care Pharmaceuticals 54.070000 33.177346 2.299304 9.000000 30.000000 1010500000.000000 847600000.000000 1.580000 1633015873.000000 33.430380 -4.213309 1
NAVI Navient Financials Consumer Finance 11.450000 1.868327 2.230827 25.000000 99.000000 151000000.000000 997000000.000000 2.660000 374812030.100000 4.304511 -1.880943 1
NBL Noble Energy Inc Energy Oil & Gas Exploration & Production 32.930000 7.298791 2.509437 24.000000 57.000000 -155000000.000000 -2441000000.000000 -6.070000 402141680.400000 93.089287 1.171229 1
NDAQ NASDAQ OMX Group Financials Diversified Financial Services 58.169998 8.810324 1.563258 8.000000 117.000000 -126000000.000000 428000000.000000 2.560000 167187500.000000 22.722655 -11.717383 1
NEE NextEra Energy Utilities MultiUtilities 103.889999 6.237855 1.023375 12.000000 6.000000 -6000000.000000 2752000000.000000 6.110000 450409165.300000 17.003273 -7.353314 1
NEM Newmont Mining Corp. (Hldg. Co.) Materials Gold 17.990000 10.844116 2.536050 2.000000 198.000000 379000000.000000 220000000.000000 0.430000 511627907.000000 41.837209 6.971864 1
NFLX Netflix Inc. Information Technology Internet Software & Services 114.379997 11.145654 2.605949 6.000000 65.000000 695722000.000000 122641000.000000 0.290000 422900000.000000 394.413783 -5.700168 1
NFX Newfield Exploration Co Energy Oil & Gas Exploration & Production 32.560001 -3.296695 2.421529 244.000000 1.000000 -9000000.000000 -3362000000.000000 -21.180000 158734655.300000 93.089287 -0.138596 1
NLSN Nielsen Holdings Industrials Research & Consulting Services 46.599998 4.931317 1.198493 13.000000 21.000000 84000000.000000 570000000.000000 1.550000 367741935.500000 30.064515 -12.375526 1
NOV National Oilwell Varco Inc. Energy Oil & Gas Equipment & Services 33.490002 -12.558739 1.952020 5.000000 49.000000 -1456000000.000000 -769000000.000000 -1.990000 386432160.800000 93.089287 9.582536 1
NSC Norfolk Southern Corp. Industrials Railroads 84.589996 9.529966 2.168814 13.000000 49.000000 128000000.000000 1556000000.000000 5.130000 303313840.200000 16.489278 0.926433 1
NTRS Northern Trust Corp. Financials Asset Management & Custody Banks 72.089996 5.796884 1.281566 11.000000 67.000000 3394000000.000000 973800000.000000 4.030000 241637717.100000 17.888336 -13.398380 1
NUE Nucor Corp. Materials Steel 40.299999 6.585554 1.460619 5.000000 147.000000 915325000.000000 357659000.000000 1.110000 322215315.300000 36.306305 11.168107 1
NWL Newell Brands Consumer Discretionary Housewares & Specialties 44.080002 9.980039 1.641300 19.000000 14.000000 75400000.000000 350000000.000000 1.300000 269230769.200000 33.907694 -2.075543 1
O Realty Income Corporation Real Estate Retail REITs 51.630001 8.420836 1.104581 4.000000 47.000000 36442000.000000 283766000.000000 1.090000 260335779.800000 47.366973 -3.973395 1
OKE ONEOK Energy Oil & Gas Exploration & Production 24.660000 -24.123077 3.560178 73.000000 6.000000 -75150000.000000 244977000.000000 1.170000 209382051.300000 21.076923 -8.025110 1
OMC Omnicom Group Consumer Discretionary Advertising 75.660004 14.810321 1.066369 45.000000 18.000000 217100000.000000 1093900000.000000 4.430000 246930022.600000 17.079008 -10.464098 1
ORLY O'Reilly Automotive Consumer Discretionary Specialty Stores 253.419998 0.964143 1.089370 47.000000 4.000000 -134259000.000000 931216000.000000 9.320000 99915879.830000 27.190987 -0.364026 1
OXY Occidental Petroleum Energy Oil & Gas Exploration & Production 67.610001 0.865287 1.589520 32.000000 64.000000 -588000000.000000 -7829000000.000000 -10.230000 765298142.700000 93.089287 3.345102 1
PBCT People's United Financial Financials Thrifts & Mortgage Finance 16.150000 3.128991 1.132813 5.000000 99.000000 -298400000.000000 260100000.000000 0.860000 302441860.500000 18.779070 -0.426859 1
PBI Pitney-Bowes Industrials Technology, Hardware, Software and Supplies 20.650000 3.821021 1.259611 228.000000 34.000000 -403561000.000000 407943000.000000 2.040000 199972058.800000 10.122549 -0.733207 1
PCAR PACCAR Inc. Industrials Construction & Farm Machinery & Heavy Trucks 47.400002 -9.317004 1.439564 23.000000 110.000000 278800000.000000 1604000000.000000 4.520000 354867256.600000 10.486726 6.290521 1
PCG PG&E Corp. Utilities MultiUtilities 53.189999 0.510206 1.039803 5.000000 6.000000 -28000000.000000 888000000.000000 1.810000 490607734.800000 29.386740 -1.121059 1
PCLN Priceline.com Inc Consumer Discretionary Internet & Direct Marketing Retail 1274.949951 3.190527 1.268340 29.000000 184.000000 -1671386000.000000 2551360000.000000 50.090000 50935516.070000 25.453183 -1.052429 1
PEG Public Serv. Enterprise Inc. Utilities Electric Utilities 38.689999 -8.230553 1.180661 13.000000 11.000000 -8000000.000000 1679000000.000000 3.320000 505722891.600000 11.653614 -0.361858 1
PEP PepsiCo Inc. Consumer Staples Soft Drinks 99.919998 6.072188 0.805357 45.000000 68.000000 2962000000.000000 5452000000.000000 3.710000 1469541779.000000 26.932614 -5.190734 1
PFE Pfizer Inc. Health Care Pharmaceuticals 32.279999 3.130991 1.238748 11.000000 79.000000 298000000.000000 6960000000.000000 1.130000 6159292035.000000 28.566371 -4.213309 1
PFG Principal Financial Group Financials Diversified Financial Services 44.980000 -5.305263 1.528985 13.000000 117.000000 700900000.000000 1234000000.000000 4.110000 300243309.000000 10.944039 -4.526995 1
PG Procter & Gamble Consumer Staples Personal Products 79.410004 10.660538 0.806056 17.000000 129.000000 160383000.000000 636056000.000000 3.280000 491391569.000000 24.070121 -2.256747 1
PGR Progressive Corp. Financials Property & Casualty Insurance 31.799999 3.515625 1.086898 17.000000 99.000000 116000000.000000 1267600000.000000 2.160000 586851851.900000 14.722222 -0.843313 1
PHM Pulte Homes Inc. Consumer Discretionary Homebuilding 17.820000 -5.564393 1.694751 10.000000 25.000000 -533785000.000000 494090000.000000 1.380000 358036231.900000 12.913043 -0.307832 1
PM Philip Morris International Consumer Staples Tobacco 87.910004 10.328820 0.861453 52.000000 22.000000 1735000000.000000 6873000000.000000 4.420000 1554977376.000000 19.889141 -1.418027 1
PNC PNC Financial Services Financials Banks 95.309998 6.993709 1.120534 9.000000 99.000000 -295000000.000000 4106000000.000000 7.520000 546010638.300000 12.674202 -0.694126 1
PNR Pentair Ltd. Industrials Industrial Machinery 49.529999 -3.034462 1.875910 2.000000 8.000000 15900000.000000 -76400000.000000 -0.420000 181904761.900000 14.579221 -6.574869 1
PNW Pinnacle West Capital Utilities MultiUtilities 64.480003 0.498752 1.143421 10.000000 3.000000 31884000.000000 437257000.000000 3.940000 110978934.000000 16.365483 -6.089228 1
PPG PPG Industries Materials Diversified Chemicals 98.820000 19.160738 1.533003 28.000000 31.000000 625000000.000000 1406000000.000000 5.180000 271428571.400000 19.077220 -0.593158 1
PPL PPL Corp. Utilities Electric Utilities 34.130001 3.424245 1.109059 7.000000 22.000000 -563000000.000000 682000000.000000 1.010000 675247524.800000 33.792080 -2.827111 1
PRU Prudential Financial Financials Diversified Financial Services 81.410004 6.585503 1.227467 13.000000 117.000000 2694000000.000000 5642000000.000000 12.370000 456103476.200000 6.581245 -4.178927 1
PSX Phillips 66 Energy Oil & Gas Refining & Marketing & Transportation 81.800003 5.371643 1.379589 18.000000 41.000000 -2133000000.000000 4227000000.000000 7.780000 543316195.400000 10.514139 7.029056 1
PWR Quanta Services Inc. Industrials Industrial Conglomerates 20.250000 -16.632362 2.954291 10.000000 11.000000 -61744000.000000 321824000.000000 1.590000 202405031.400000 12.735849 4.291894 1
PX Praxair Inc. Materials Industrial Gases 102.400002 0.293834 1.131240 35.000000 8.000000 21000000.000000 1547000000.000000 5.390000 287012987.000000 18.998145 0.574887 1
PYPL PayPal Information Technology Data Processing & Outsourced Services 36.200001 17.456201 1.925754 9.000000 25.000000 -808000000.000000 1228000000.000000 1.000000 1228000000.000000 36.200001 5.434039 1
R Ryder System Industrials Industrial Conglomerates 56.830002 -23.244191 1.945966 15.000000 4.000000 10853000.000000 304768000.000000 5.750000 53003130.430000 9.883479 -12.020894 1
RCL Royal Caribbean Cruises Ltd Consumer Discretionary Hotels, Resorts & Cruise Lines 101.209999 13.425973 1.556512 8.000000 9.000000 -67676000.000000 665783000.000000 3.030000 219730363.000000 33.402640 -15.727481 1
REGN Regeneron Health Care Biotechnology 542.869995 16.995320 1.802345 17.000000 129.000000 160383000.000000 636056000.000000 6.170000 103088492.700000 87.985412 20.409000 1
RHI Robert Half International Industrials Human Resource & Employment Services 47.139999 -7.659158 1.142370 36.000000 34.000000 -62542000.000000 357796000.000000 2.720000 131542647.100000 17.330882 4.089472 1
ROP Roper Industries Industrials Industrial Conglomerates 189.789993 20.432767 1.058807 13.000000 108.000000 168081000.000000 696067000.000000 6.920000 100587716.800000 27.426300 -16.215469 1
RRC Range Resources Corp. Energy Oil & Gas Exploration & Production 24.610001 -25.106512 3.712995 26.000000 0.000000 23000.000000 -713685000.000000 -4.290000 166360139.900000 93.089287 0.525090 1
RSG Republic Services Inc Industrials Industrial Conglomerates 43.990002 6.745943 0.839821 10.000000 2.000000 -42800000.000000 749900000.000000 2.140000 350420560.700000 20.556076 -2.428225 1
SCG SCANA Corp Utilities MultiUtilities 60.490002 7.232764 1.266240 14.000000 9.000000 39000000.000000 746000000.000000 5.220000 142911877.400000 11.588123 -4.016461 1
SCHW Charles Schwab Corporation Financials Investment Banking & Brokerage 32.930000 15.462833 1.456940 11.000000 99.000000 615000000.000000 1447000000.000000 1.040000 1391346154.000000 31.663462 -0.130090 1
SE Spectra Energy Corp. Energy Oil & Gas Refining & Marketing & Transportation 23.940001 -9.898378 2.030786 3.000000 6.000000 -2000000.000000 196000000.000000 0.290000 675862069.000000 82.551728 -2.580408 1
SEE Sealed Air Materials Paper Packaging 44.599998 -5.146750 1.580117 43.000000 19.000000 73000000.000000 225400000.000000 1.630000 138282208.600000 27.361962 -2.716908 1
SHW Sherwin-Williams Materials Specialty Chemicals 259.600006 16.537983 1.426488 121.000000 10.000000 165012000.000000 1053849000.000000 11.380000 92605360.280000 22.811951 2.825366 1
SLG SL Green Realty Real Estate Office REITs 112.980003 4.004424 1.091967 4.000000 47.000000 -26010000.000000 284084000.000000 1.020000 278513725.500000 110.764709 -3.089477 1
SNI Scripps Networks Interactive Inc. Consumer Discretionary Broadcasting & Cable TV 55.209999 12.238260 1.773865 40.000000 23.000000 -654720000.000000 606828000.000000 4.680000 129664102.600000 11.797008 -7.961579 1
SO Southern Co. Utilities Electric Utilities 46.790001 4.372070 0.895059 11.000000 15.000000 694000000.000000 2421000000.000000 2.600000 931153846.200000 17.996154 -2.795456 1
SPG Simon Property Group Inc Real Estate REITs 194.440002 5.284822 1.135546 48.000000 47.000000 88852000.000000 2139375000.000000 5.880000 363839285.700000 33.068028 -1.269332 1
SPGI S&P Global, Inc. Financials Diversified Financial Services 98.580002 14.044424 1.080858 596.000000 51.000000 -1016000000.000000 1156000000.000000 4.260000 271361502.300000 23.140846 -4.178927 1
SRCL Stericycle Inc Industrials Industrial Conglomerates 120.599998 -13.906342 1.203816 10.000000 9.000000 33398000.000000 267046000.000000 3.020000 88425827.810000 39.933774 -18.864194 1
SRE Sempra Energy Utilities MultiUtilities 94.010002 -2.791849 1.126448 11.000000 9.000000 -167000000.000000 1350000000.000000 5.430000 248618784.500000 17.313076 -8.547222 1
STI SunTrust Banks Financials Banks 42.840000 11.970732 1.437938 8.000000 99.000000 -2630000000.000000 1933000000.000000 3.620000 533977900.600000 11.834254 -2.481376 1
STT State Street Corp. Financials Diversified Financial Services 66.360001 -0.866449 1.444644 9.000000 117.000000 -648000000.000000 1980000000.000000 4.530000 437086092.700000 14.649007 -4.044970 1
SWKS Skyworks Solutions Information Technology Semiconductors 76.830002 -8.513933 2.017394 25.000000 225.000000 237800000.000000 798300000.000000 4.210000 189619952.500000 18.249407 7.413777 1
SWN Southwestern Energy Energy Oil & Gas Exploration & Production 7.110000 -44.798137 4.580042 200.000000 2.000000 -38000000.000000 -4556000000.000000 -6.070000 402141680.400000 93.089287 1.273530 1
SYF Synchrony Financial Financials Consumer Finance 30.410000 -2.874478 1.835028 18.000000 99.000000 497000000.000000 2214000000.000000 2.660000 832330827.100000 11.432331 -0.842213 1
SYK Stryker Corp. Health Care Health Care Equipment 92.940002 -1.650792 1.138163 17.000000 116.000000 1584000000.000000 1439000000.000000 3.820000 376701570.700000 24.329843 7.026782 1
T AT&T Inc Telecommunications Services Integrated Telecommunications Services 34.410000 5.942118 0.859442 11.000000 11.000000 -3482000000.000000 13345000000.000000 2.370000 5630801688.000000 14.518987 -23.537323 1
TAP Molson Coors Brewing Company Consumer Staples Brewers 93.919998 13.129368 1.217803 5.000000 35.000000 -150300000.000000 359500000.000000 1.940000 185309278.400000 48.412370 -25.385129 1
TDC Teradata Corp. Information Technology Application Software 26.420000 -8.833678 2.730659 25.000000 88.000000 5000000.000000 -214000000.000000 -1.530000 139869281.000000 74.555557 4.068084 1
TGNA Tegna, Inc. Consumer Discretionary Publishing 25.520000 13.624226 1.797269 21.000000 21.000000 10716000.000000 459522000.000000 2.040000 225255882.400000 12.509804 -12.726553 1
TMK Torchmark Corp. Financials Life & Health Insurance 57.160000 1.168142 1.022968 13.000000 99.000000 -4636000.000000 527100000.000000 4.210000 125201900.200000 13.577197 -1.883912 1
TMO Thermo Fisher Scientific Health Care Health Care Equipment 141.850006 15.607180 1.247751 9.000000 11.000000 -891400000.000000 1975400000.000000 4.960000 398266129.000000 28.598792 -28.032512 1
TRIP TripAdvisor Consumer Discretionary Internet & Direct Marketing Retail 85.250000 34.803917 1.578344 14.000000 212.000000 159000000.000000 198000000.000000 1.380000 143478260.900000 61.775362 2.627576 1
TRV The Travelers Companies Inc. Financials Property & Casualty Insurance 112.860001 13.029548 0.959365 15.000000 99.000000 6000000.000000 3439000000.000000 10.990000 312920837.100000 10.269336 -0.891599 1
TSCO Tractor Supply Company Consumer Discretionary Specialty Retail 85.500000 1.303315 1.431109 29.000000 10.000000 12679000.000000 410395000.000000 3.030000 135443894.400000 28.217822 6.010954 1
TSN Tyson Foods Consumer Staples Packaged Foods & Meats 53.330002 23.249369 1.586719 13.000000 19.000000 250000000.000000 1220000000.000000 3.280000 199237804.900000 24.070121 -1.980483 1
TSO Tesoro Petroleum Co. Energy Oil & Gas Refining & Marketing & Transportation 105.370003 8.584091 1.854132 30.000000 37.000000 -58000000.000000 1540000000.000000 12.500000 123200000.000000 8.429600 4.594156 1
TSS Total System Services Information Technology Internet Software & Services 49.799999 9.234479 1.579248 20.000000 115.000000 100145000.000000 369041000.000000 1.980000 186384343.400000 25.151515 -2.347391 1
TXN Texas Instruments Information Technology Semiconductors 54.810001 9.971912 1.263479 30.000000 126.000000 -199000000.000000 2986000000.000000 2.860000 1044055944.000000 19.164336 2.768051 1
UAA Under Armour Consumer Discretionary Apparel, Accessories & Luxury Goods 80.610001 -16.948277 1.758824 14.000000 27.000000 -463323000.000000 232573000.000000 3.030000 213598256.500000 20.819876 -0.857290 1
UAL United Continental Holdings Industrials Airlines 57.299999 8.215294 1.747606 82.000000 42.000000 1004000000.000000 7340000000.000000 19.520000 376024590.200000 2.935451 -23.195292 1
UDR UDR Inc Real Estate Residential REITs 37.570000 8.583821 1.157906 12.000000 47.000000 -8482000.000000 340383000.000000 1.300000 261833076.900000 28.900000 -3.089477 1
UHS Universal Health Services, Inc. Health Care Health Care Facilities 119.489998 -5.136552 2.048697 16.000000 6.000000 29159000.000000 680528000.000000 6.890000 98770391.870000 17.342525 6.255903 1
UNH United Health Group Inc. Health Care Managed Health Care 117.639999 1.466273 1.482349 17.000000 70.000000 3428000000.000000 5813000000.000000 6.100000 952950819.700000 19.285246 -8.805281 1
UNM Unum Group Financials Diversified Financial Services 33.290001 3.804181 1.102848 10.000000 117.000000 10400000.000000 867100000.000000 3.510000 247037037.000000 9.484331 -4.178927 1
UNP Union Pacific Industrials Railroads 78.199997 -12.371135 1.430297 23.000000 43.000000 -195000000.000000 4772000000.000000 5.510000 866061706.000000 14.192377 1.066899 1
UPS United Parcel Service Industrials Air Freight & Logistics 96.230003 -2.797977 0.826408 196.000000 44.000000 439000000.000000 4844000000.000000 5.380000 900371747.200000 17.886618 1.069558 1
UTX United Technologies Industrials Industrial Conglomerates 96.070000 8.065239 0.949396 28.000000 31.000000 1630000000.000000 7608000000.000000 8.720000 872477064.200000 11.017202 -13.198055 1
VAR Varian Medical Systems Health Care Health Care Equipment 80.800003 9.248248 1.034843 24.000000 61.000000 -3800000.000000 411500000.000000 4.130000 99636803.870000 19.564165 9.471400 1
VLO Valero Energy Energy Oil & Gas Refining & Marketing & Transportation 70.709999 17.341522 1.626934 19.000000 56.000000 425000000.000000 3990000000.000000 8.000000 498750000.000000 8.838750 15.262155 1
VMC Vulcan Materials Materials Construction Materials 94.970001 6.028805 1.845710 5.000000 81.000000 142787000.000000 221177000.000000 1.660000 133239156.600000 57.210844 -0.266191 1
VNO Vornado Realty Trust Real Estate REITs 99.959999 10.027519 1.019724 11.000000 47.000000 637230000.000000 760434000.000000 3.610000 210646537.400000 27.689750 -1.081912 1
VRSK Verisk Analytics Industrials Research & Consulting Services 76.879997 -1.448539 1.454019 37.000000 10.000000 98989000.000000 507577000.000000 3.070000 165334527.700000 25.042344 -13.617440 1
VRSN Verisign Inc. Information Technology Internet Software & Services 87.360001 23.459580 1.379480 35.000000 127.000000 37051000.000000 375236000.000000 3.290000 114053495.400000 26.553192 4.076543 1
VRTX Vertex Pharmaceuticals Inc Health Care Biotechnology 125.830002 21.928300 2.456535 59.000000 221.000000 89509000.000000 -556334000.000000 -2.310000 240837229.400000 39.602928 2.559671 1
VTR Ventas Inc Real Estate REITs 56.430000 0.213104 1.444924 4.000000 47.000000 -1803000.000000 419222000.000000 1.260000 332715873.000000 44.785714 -4.040751 1
VZ Verizon Communications Telecommunications Services Integrated Telecommunications Services 46.220001 6.277303 0.842592 109.000000 14.000000 -6128000000.000000 17879000000.000000 4.380000 4081963470.000000 10.552512 -26.380687 1
WAT Waters Corporation Health Care Health Care Distributors 134.580002 13.925341 1.044615 23.000000 425.000000 65488000.000000 469053000.000000 5.700000 82290000.000000 23.610527 29.547150 1
WEC Wec Energy Group Inc Utilities Electric Utilities 51.310001 -1.986623 1.103033 7.000000 2.000000 -12100000.000000 640300000.000000 2.360000 271313559.300000 21.741526 -1.850995 1
WFC Wells Fargo Financials Banks 54.360001 5.532912 0.969774 12.000000 99.000000 -460000000.000000 22894000000.000000 4.180000 5477033493.000000 13.004785 -0.938007 1
WHR Whirlpool Corp. Consumer Discretionary Household Appliances 146.869995 -0.230971 2.397803 17.000000 10.000000 -254000000.000000 783000000.000000 9.950000 78693467.340000 14.760804 -45.086335 1
WM Waste Management Inc. Industrials Environmental Services 53.369999 7.061186 0.940366 14.000000 2.000000 -1268000000.000000 753000000.000000 1.660000 453614457.800000 32.150602 -1.415299 1
WMB Williams Cos. Energy Oil & Gas Exploration & Production 25.700001 -30.988186 3.719560 9.000000 4.000000 -140000000.000000 -571000000.000000 -0.760000 751315789.500000 93.089287 -14.561121 1
WU Western Union Co Information Technology Internet Software & Services 17.910000 -2.610109 1.273051 60.000000 16.000000 -467300000.000000 837800000.000000 1.630000 513987730.100000 10.987730 -8.043772 1
WY Weyerhaeuser Corp. Real Estate REITs 29.980000 8.544529 1.338067 10.000000 116.000000 -568000000.000000 506000000.000000 0.890000 568539325.800000 33.685393 2.284802 1
WYN Wyndham Worldwide Consumer Discretionary Hotels, Resorts & Cruise Lines 72.650002 1.000976 1.331918 64.000000 9.000000 -12000000.000000 612000000.000000 5.180000 118146718.100000 14.025097 -10.249967 1
WYNN Wynn Resorts Ltd Consumer Discretionary Casinos & Gaming 69.190002 29.496541 3.794783 174.000000 198.000000 -102075000.000000 195290000.000000 1.930000 101186528.500000 35.849742 12.695712 1
XEC Cimarex Energy Energy Oil & Gas Exploration & Production 89.379997 -14.403372 2.397940 86.000000 190.000000 373520000.000000 -2408948000.000000 -25.920000 92937808.640000 93.089287 7.186128 1
XEL Xcel Energy Inc Utilities MultiUtilities 35.910000 1.383405 1.015052 9.000000 2.000000 5332000.000000 984485000.000000 1.940000 507466494.800000 18.510309 -2.261927 1
XL XL Capital Financials Property & Casualty Insurance 39.180000 7.696534 0.991011 10.000000 99.000000 734422000.000000 1201560000.000000 4.220000 284729857.800000 9.284360 -7.762677 1
XOM Exxon Mobil Corp. Energy Integrated Oil & Gas 77.949997 3.656915 1.370062 9.000000 7.000000 -911000000.000000 16150000000.000000 3.850000 4194805195.000000 20.246752 -2.706443 1
XRAY Dentsply Sirona Health Care Health Care Supplies 60.849998 19.901474 1.007230 11.000000 60.000000 133000000.000000 251200000.000000 1.790000 140335195.500000 33.994412 0.855096 1
XRX Xerox Corp. Information Technology IT Consulting & Other Services 10.630000 9.474768 1.866680 5.000000 26.000000 -43000000.000000 474000000.000000 0.420000 1128571429.000000 25.309524 -0.295949 1
XYL Xylem Inc. Industrials Industrial Conglomerates 36.500000 11.009729 1.166311 16.000000 83.000000 17000000.000000 340000000.000000 1.880000 180851063.800000 19.414894 4.130471 1
YHOO Yahoo Inc. Information Technology Internet Software & Services 33.259998 14.887727 1.845149 15.000000 459.000000 -1032187000.000000 -4359082000.000000 -4.640000 939457327.600000 28.976191 6.261775 1
YUM Yum! Brands Inc Consumer Discretionary Restaurants 52.516175 -8.698917 1.478877 142.000000 27.000000 159000000.000000 1293000000.000000 2.970000 435353535.400000 17.682214 -3.838260 1
ZBH Zimmer Biomet Holdings Health Care Health Care Equipment 102.589996 9.347683 1.404206 1.000000 100.000000 376000000.000000 147000000.000000 0.780000 188461538.500000 131.525636 -23.884449 1
ZION Zions Bancorp Financials Regional Banks 27.299999 -1.158588 1.468176 4.000000 99.000000 -43623000.000000 309471000.000000 1.200000 257892500.000000 22.749999 -0.063096 1
ZTS Zoetis Health Care Pharmaceuticals 47.919998 16.678836 1.610285 32.000000 65.000000 272000000.000000 339000000.000000 0.680000 498529411.800000 70.470585 1.723068 1
In [208]:
max_df=hc_cluster_profile.style.highlight_max(color="lightgreen", axis=0)
In [209]:
type(max_df)
Out[209]:
pandas.io.formats.style.Styler
You can retrieve the original dataframe from the styler object using the "data" attribute.

In your example:

df = final_df.data

type(df) yields

pandas.core.frame.DataFrame

Is there a way to convert data frame styler object into dataframe in python

In [210]:
max_df_df=max_df.data
for col in max_df_df.columns:
    
    # for i in max_df[col]:
    print(col)
Current Price
Price Change
Volatility
ROE
Cash Ratio
Net Cash Flow
Net Income
Earnings Per Share
Estimated Shares Outstanding
P/E Ratio
P/B Ratio
count_in_each_segment
In [211]:
type(max_df_df)
Out[211]:
pandas.core.frame.DataFrame
In [212]:
# TODO
# Try to get max of each column and print it.

To find the maximum value of a column and to return its corresponding row values in Pandas, we can use:

df.loc[df[col].idxmax()]

Python Pandas – Find the maximum value of a column and return its corresponding row values%5D.)

In [213]:
max=max_df_df.loc[max_df_df[col].idxmax()]
In [214]:
max
Out[214]:
Current Price                   4.235000e+01
Price Change                    9.999995e+00
Volatility                      1.687151e+00
ROE                             1.350000e+02
Cash Ratio                      5.100000e+01
Net Cash Flow                  -6.040000e+08
Net Income                      7.610000e+09
Earnings Per Share              1.139000e+01
Estimated Shares Outstanding    6.681299e+08
P/E Ratio                       3.718174e+00
P/B Ratio                      -8.784219e+00
count_in_each_segment           1.000000e+00
Name: (0, AAL, American Airlines Group, Industrials, Airlines), dtype: float64
In [215]:
index_of_max=max_df_df[col].idxmax()
In [216]:
index_of_max
Out[216]:
(0, 'AAL', 'American Airlines Group', 'Industrials', 'Airlines')
In [217]:
max=max_df_df.loc[max_df_df[col].idxmax()]
index_of_max=max_df_df[col].idxmax()
In [218]:
max_df_df.head(5)
Out[218]:
Current Price Price Change Volatility ROE Cash Ratio Net Cash Flow Net Income Earnings Per Share Estimated Shares Outstanding P/E Ratio P/B Ratio count_in_each_segment
HC_segments Ticker Symbol Security GICS Sector GICS Sub Industry
0 AAL American Airlines Group Industrials Airlines 42.349998 9.999995 1.687151 135.0 51.0 -604000000.0 7.610000e+09 11.39 6.681299e+08 3.718174 -8.784219 1
ABBV AbbVie Health Care Pharmaceuticals 59.240002 8.339433 2.197887 130.0 77.0 51000000.0 5.144000e+09 3.15 1.633016e+09 18.806350 -8.750068 1
ABT Abbott Laboratories Health Care Health Care Equipment 44.910000 11.301121 1.273646 21.0 67.0 938000000.0 4.423000e+09 2.94 1.504422e+09 15.275510 -0.394171 1
ADBE Adobe Systems Inc Information Technology Application Software 93.940002 13.977195 1.357679 9.0 180.0 -240840000.0 6.295510e+08 1.26 4.996437e+08 74.555557 4.199651 1
ADI Analog Devices, Inc. Information Technology Semiconductors 55.320000 -1.827858 1.701169 14.0 272.0 315120000.0 6.968780e+08 0.31 2.247994e+09 178.451613 1.059810 1
In [219]:
for index,col in enumerate(max_df_df.columns):
    print(col)
    # print(max_df_df[col].idxmax())
    print('index',index)
    print('col',col)
    # print(max_df_df[col][index])
Current Price
index 0
col Current Price
Price Change
index 1
col Price Change
Volatility
index 2
col Volatility
ROE
index 3
col ROE
Cash Ratio
index 4
col Cash Ratio
Net Cash Flow
index 5
col Net Cash Flow
Net Income
index 6
col Net Income
Earnings Per Share
index 7
col Earnings Per Share
Estimated Shares Outstanding
index 8
col Estimated Shares Outstanding
P/E Ratio
index 9
col P/E Ratio
P/B Ratio
index 10
col P/B Ratio
count_in_each_segment
index 11
col count_in_each_segment
In [220]:
    # max=max_df_df.loc[max_df_df[col].idxmax()]
    # index_of_max=max_df_df[col].idxmax()
    # max_df_df[col].idxmax()
    # for i,val in enumerate(max_df_df[col]):
In [221]:
        # if max_df_df[col][i] == max:
        # if max_df_df[col][i] == 42.349998:
        # print(max_df_df[col][i])
        # print(max_df_df[col][i])
        # print(val)
  • loop through each unique 'Ticker Symbol' in df2 and
  • print result of comparison between df2 df2 'Ticker Symbol' and c1 "Security" .unique()
In [222]:
## Complete the code to print the companies in each cluster
for cl in df2['Ticker Symbol'].unique():
    print("In cluster {}, the following companies are present:".format(cl))
    print(df2[df2['Ticker Symbol'] == cl]["Security"].unique())
    print()
In cluster AAL, the following companies are present:
['American Airlines Group']

In cluster ABBV, the following companies are present:
['AbbVie']

In cluster ABT, the following companies are present:
['Abbott Laboratories']

In cluster ADBE, the following companies are present:
['Adobe Systems Inc']

In cluster ADI, the following companies are present:
['Analog Devices, Inc.']

In cluster ADM, the following companies are present:
['Archer-Daniels-Midland Co']

In cluster ADS, the following companies are present:
['Alliance Data Systems']

In cluster AEE, the following companies are present:
['Ameren Corp']

In cluster AEP, the following companies are present:
['American Electric Power']

In cluster AFL, the following companies are present:
['AFLAC Inc']

In cluster AIG, the following companies are present:
['American International Group, Inc.']

In cluster AIV, the following companies are present:
['Apartment Investment & Mgmt']

In cluster AIZ, the following companies are present:
['Assurant Inc']

In cluster AJG, the following companies are present:
['Arthur J. Gallagher & Co.']

In cluster AKAM, the following companies are present:
['Akamai Technologies Inc']

In cluster ALB, the following companies are present:
['Albemarle Corp']

In cluster ALK, the following companies are present:
['Alaska Air Group Inc']

In cluster ALL, the following companies are present:
['Allstate Corp']

In cluster ALLE, the following companies are present:
['Allegion']

In cluster ALXN, the following companies are present:
['Alexion Pharmaceuticals']

In cluster AMAT, the following companies are present:
['Applied Materials Inc']

In cluster AME, the following companies are present:
['AMETEK Inc']

In cluster AMG, the following companies are present:
['Affiliated Managers Group Inc']

In cluster AMGN, the following companies are present:
['Amgen Inc']

In cluster AMP, the following companies are present:
['Ameriprise Financial']

In cluster AMT, the following companies are present:
['American Tower Corp A']

In cluster AMZN, the following companies are present:
['Amazon.com Inc']

In cluster AN, the following companies are present:
['AutoNation Inc']

In cluster ANTM, the following companies are present:
['Anthem Inc.']

In cluster AON, the following companies are present:
['Aon plc']

In cluster APA, the following companies are present:
['Apache Corporation']

In cluster APC, the following companies are present:
['Anadarko Petroleum Corp']

In cluster APH, the following companies are present:
['Amphenol Corp']

In cluster ARNC, the following companies are present:
['Arconic Inc']

In cluster ATVI, the following companies are present:
['Activision Blizzard']

In cluster AVB, the following companies are present:
['AvalonBay Communities, Inc.']

In cluster AVGO, the following companies are present:
['Broadcom']

In cluster AWK, the following companies are present:
['American Water Works Company Inc']

In cluster AXP, the following companies are present:
['American Express Co']

In cluster BA, the following companies are present:
['Boeing Company']

In cluster BAC, the following companies are present:
['Bank of America Corp']

In cluster BAX, the following companies are present:
['Baxter International Inc.']

In cluster BBT, the following companies are present:
['BB&T Corporation']

In cluster BCR, the following companies are present:
['Bard (C.R.) Inc.']

In cluster BHI, the following companies are present:
['Baker Hughes Inc']

In cluster BIIB, the following companies are present:
['BIOGEN IDEC Inc.']

In cluster BK, the following companies are present:
['The Bank of New York Mellon Corp.']

In cluster BLL, the following companies are present:
['Ball Corp']

In cluster BMY, the following companies are present:
['Bristol-Myers Squibb']

In cluster BSX, the following companies are present:
['Boston Scientific']

In cluster BWA, the following companies are present:
['BorgWarner']

In cluster BXP, the following companies are present:
['Boston Properties']

In cluster C, the following companies are present:
['Citigroup Inc.']

In cluster CAT, the following companies are present:
['Caterpillar Inc.']

In cluster CB, the following companies are present:
['Chubb Limited']

In cluster CBG, the following companies are present:
['CBRE Group']

In cluster CCI, the following companies are present:
['Crown Castle International Corp.']

In cluster CCL, the following companies are present:
['Carnival Corp.']

In cluster CELG, the following companies are present:
['Celgene Corp.']

In cluster CF, the following companies are present:
['CF Industries Holdings Inc']

In cluster CFG, the following companies are present:
['Citizens Financial Group']

In cluster CHD, the following companies are present:
['Church & Dwight']

In cluster CHK, the following companies are present:
['Chesapeake Energy']

In cluster CHRW, the following companies are present:
['C. H. Robinson Worldwide']

In cluster CHTR, the following companies are present:
['Charter Communications']

In cluster CI, the following companies are present:
['CIGNA Corp.']

In cluster CINF, the following companies are present:
['Cincinnati Financial']

In cluster CL, the following companies are present:
['Colgate-Palmolive']

In cluster CMA, the following companies are present:
['Comerica Inc.']

In cluster CME, the following companies are present:
['CME Group Inc.']

In cluster CMG, the following companies are present:
['Chipotle Mexican Grill']

In cluster CMI, the following companies are present:
['Cummins Inc.']

In cluster CMS, the following companies are present:
['CMS Energy']

In cluster CNC, the following companies are present:
['Centene Corporation']

In cluster CNP, the following companies are present:
['CenterPoint Energy']

In cluster COF, the following companies are present:
['Capital One Financial']

In cluster COG, the following companies are present:
['Cabot Oil & Gas']

In cluster COO, the following companies are present:
['The Cooper Companies']

In cluster CSX, the following companies are present:
['CSX Corp.']

In cluster CTL, the following companies are present:
['CenturyLink Inc']

In cluster CTSH, the following companies are present:
['Cognizant Technology Solutions']

In cluster CTXS, the following companies are present:
['Citrix Systems']

In cluster CVS, the following companies are present:
['CVS Health']

In cluster CVX, the following companies are present:
['Chevron Corp.']

In cluster CXO, the following companies are present:
['Concho Resources']

In cluster D, the following companies are present:
['Dominion Resources']

In cluster DAL, the following companies are present:
['Delta Air Lines']

In cluster DD, the following companies are present:
['Du Pont (E.I.)']

In cluster DE, the following companies are present:
['Deere & Co.']

In cluster DFS, the following companies are present:
['Discover Financial Services']

In cluster DGX, the following companies are present:
['Quest Diagnostics']

In cluster DHR, the following companies are present:
['Danaher Corp.']

In cluster DIS, the following companies are present:
['The Walt Disney Company']

In cluster DISCA, the following companies are present:
['Discovery Communications-A']

In cluster DISCK, the following companies are present:
['Discovery Communications-C']

In cluster DLPH, the following companies are present:
['Delphi Automotive']

In cluster DLR, the following companies are present:
['Digital Realty Trust']

In cluster DNB, the following companies are present:
['Dun & Bradstreet']

In cluster DOV, the following companies are present:
['Dover Corp.']

In cluster DPS, the following companies are present:
['Dr Pepper Snapple Group']

In cluster DUK, the following companies are present:
['Duke Energy']

In cluster DVA, the following companies are present:
['DaVita Inc.']

In cluster DVN, the following companies are present:
['Devon Energy Corp.']

In cluster EBAY, the following companies are present:
['eBay Inc.']

In cluster ECL, the following companies are present:
['Ecolab Inc.']

In cluster ED, the following companies are present:
['Consolidated Edison']

In cluster EFX, the following companies are present:
['Equifax Inc.']

In cluster EIX, the following companies are present:
["Edison Int'l"]

In cluster EMN, the following companies are present:
['Eastman Chemical']

In cluster EOG, the following companies are present:
['EOG Resources']

In cluster EQIX, the following companies are present:
['Equinix']

In cluster EQR, the following companies are present:
['Equity Residential']

In cluster EQT, the following companies are present:
['EQT Corporation']

In cluster ES, the following companies are present:
['Eversource Energy']

In cluster ESS, the following companies are present:
['Essex Property Trust, Inc.']

In cluster ETFC, the following companies are present:
['E*Trade']

In cluster ETN, the following companies are present:
['Eaton Corporation']

In cluster ETR, the following companies are present:
['Entergy Corp.']

In cluster EW, the following companies are present:
['Edwards Lifesciences']

In cluster EXC, the following companies are present:
['Exelon Corp.']

In cluster EXPD, the following companies are present:
["Expeditors Int'l"]

In cluster EXPE, the following companies are present:
['Expedia Inc.']

In cluster EXR, the following companies are present:
['Extra Space Storage']

In cluster F, the following companies are present:
['Ford Motor']

In cluster FAST, the following companies are present:
['Fastenal Co']

In cluster FB, the following companies are present:
['Facebook']

In cluster FBHS, the following companies are present:
['Fortune Brands Home & Security']

In cluster FCX, the following companies are present:
['Freeport-McMoran Cp & Gld']

In cluster FE, the following companies are present:
['FirstEnergy Corp']

In cluster FIS, the following companies are present:
['Fidelity National Information Services']

In cluster FISV, the following companies are present:
['Fiserv Inc']

In cluster FLIR, the following companies are present:
['FLIR Systems']

In cluster FLR, the following companies are present:
['Fluor Corp.']

In cluster FLS, the following companies are present:
['Flowserve Corporation']

In cluster FMC, the following companies are present:
['FMC Corporation']

In cluster FRT, the following companies are present:
['Federal Realty Investment Trust']

In cluster FSLR, the following companies are present:
['First Solar Inc']

In cluster FTR, the following companies are present:
['Frontier Communications']

In cluster GD, the following companies are present:
['General Dynamics']

In cluster GGP, the following companies are present:
['General Growth Properties Inc.']

In cluster GILD, the following companies are present:
['Gilead Sciences']

In cluster GLW, the following companies are present:
['Corning Inc.']

In cluster GM, the following companies are present:
['General Motors']

In cluster GPC, the following companies are present:
['Genuine Parts']

In cluster GRMN, the following companies are present:
['Garmin Ltd.']

In cluster GT, the following companies are present:
['Goodyear Tire & Rubber']

In cluster GWW, the following companies are present:
['Grainger (W.W.) Inc.']

In cluster HAL, the following companies are present:
['Halliburton Co.']

In cluster HAS, the following companies are present:
['Hasbro Inc.']

In cluster HBAN, the following companies are present:
['Huntington Bancshares']

In cluster HCA, the following companies are present:
['HCA Holdings']

In cluster HCN, the following companies are present:
['Welltower Inc.']

In cluster HCP, the following companies are present:
['HCP Inc.']

In cluster HES, the following companies are present:
['Hess Corporation']

In cluster HIG, the following companies are present:
['Hartford Financial Svc.Gp.']

In cluster HOG, the following companies are present:
['Harley-Davidson']

In cluster HON, the following companies are present:
["Honeywell Int'l Inc."]

In cluster HPE, the following companies are present:
['Hewlett Packard Enterprise']

In cluster HPQ, the following companies are present:
['HP Inc.']

In cluster HRL, the following companies are present:
['Hormel Foods Corp.']

In cluster HSIC, the following companies are present:
['Henry Schein']

In cluster HST, the following companies are present:
['Host Hotels & Resorts']

In cluster HSY, the following companies are present:
['The Hershey Company']

In cluster HUM, the following companies are present:
['Humana Inc.']

In cluster IBM, the following companies are present:
['International Business Machines']

In cluster IDXX, the following companies are present:
['IDEXX Laboratories']

In cluster IFF, the following companies are present:
['Intl Flavors & Fragrances']

In cluster INTC, the following companies are present:
['Intel Corp.']

In cluster IP, the following companies are present:
['International Paper']

In cluster IPG, the following companies are present:
['Interpublic Group']

In cluster IRM, the following companies are present:
['Iron Mountain Incorporated']

In cluster ISRG, the following companies are present:
['Intuitive Surgical Inc.']

In cluster ITW, the following companies are present:
['Illinois Tool Works']

In cluster IVZ, the following companies are present:
['Invesco Ltd.']

In cluster JBHT, the following companies are present:
['J. B. Hunt Transport Services']

In cluster JEC, the following companies are present:
['Jacobs Engineering Group']

In cluster JNPR, the following companies are present:
['Juniper Networks']

In cluster JPM, the following companies are present:
['JPMorgan Chase & Co.']

In cluster KIM, the following companies are present:
['Kimco Realty']

In cluster KMB, the following companies are present:
['Kimberly-Clark']

In cluster KMI, the following companies are present:
['Kinder Morgan']

In cluster KO, the following companies are present:
['Coca Cola Company']

In cluster KSU, the following companies are present:
['Kansas City Southern']

In cluster LEG, the following companies are present:
['Leggett & Platt']

In cluster LEN, the following companies are present:
['Lennar Corp.']

In cluster LH, the following companies are present:
['Laboratory Corp. of America Holding']

In cluster LKQ, the following companies are present:
['LKQ Corporation']

In cluster LLL, the following companies are present:
['L-3 Communications Holdings']

In cluster LLY, the following companies are present:
['Lilly (Eli) & Co.']

In cluster LMT, the following companies are present:
['Lockheed Martin Corp.']

In cluster LNT, the following companies are present:
['Alliant Energy Corp']

In cluster LUK, the following companies are present:
['Leucadia National Corp.']

In cluster LUV, the following companies are present:
['Southwest Airlines']

In cluster LVLT, the following companies are present:
['Level 3 Communications']

In cluster LYB, the following companies are present:
['LyondellBasell']

In cluster MA, the following companies are present:
['Mastercard Inc.']

In cluster MAA, the following companies are present:
['Mid-America Apartments']

In cluster MAC, the following companies are present:
['Macerich']

In cluster MAR, the following companies are present:
["Marriott Int'l."]

In cluster MAS, the following companies are present:
['Masco Corp.']

In cluster MAT, the following companies are present:
['Mattel Inc.']

In cluster MCD, the following companies are present:
["McDonald's Corp."]

In cluster MCO, the following companies are present:
["Moody's Corp"]

In cluster MDLZ, the following companies are present:
['Mondelez International']

In cluster MET, the following companies are present:
['MetLife Inc.']

In cluster MHK, the following companies are present:
['Mohawk Industries']

In cluster MJN, the following companies are present:
['Mead Johnson']

In cluster MKC, the following companies are present:
['McCormick & Co.']

In cluster MLM, the following companies are present:
['Martin Marietta Materials']

In cluster MMC, the following companies are present:
['Marsh & McLennan']

In cluster MMM, the following companies are present:
['3M Company']

In cluster MNST, the following companies are present:
['Monster Beverage']

In cluster MO, the following companies are present:
['Altria Group Inc']

In cluster MOS, the following companies are present:
['The Mosaic Company']

In cluster MPC, the following companies are present:
['Marathon Petroleum']

In cluster MRK, the following companies are present:
['Merck & Co.']

In cluster MRO, the following companies are present:
['Marathon Oil Corp.']

In cluster MTB, the following companies are present:
['M&T Bank Corp.']

In cluster MTD, the following companies are present:
['Mettler Toledo']

In cluster MUR, the following companies are present:
['Murphy Oil']

In cluster MYL, the following companies are present:
['Mylan N.V.']

In cluster NAVI, the following companies are present:
['Navient']

In cluster NBL, the following companies are present:
['Noble Energy Inc']

In cluster NDAQ, the following companies are present:
['NASDAQ OMX Group']

In cluster NEE, the following companies are present:
['NextEra Energy']

In cluster NEM, the following companies are present:
['Newmont Mining Corp. (Hldg. Co.)']

In cluster NFLX, the following companies are present:
['Netflix Inc.']

In cluster NFX, the following companies are present:
['Newfield Exploration Co']

In cluster NLSN, the following companies are present:
['Nielsen Holdings']

In cluster NOV, the following companies are present:
['National Oilwell Varco Inc.']

In cluster NSC, the following companies are present:
['Norfolk Southern Corp.']

In cluster NTRS, the following companies are present:
['Northern Trust Corp.']

In cluster NUE, the following companies are present:
['Nucor Corp.']

In cluster NWL, the following companies are present:
['Newell Brands']

In cluster O, the following companies are present:
['Realty Income Corporation']

In cluster OKE, the following companies are present:
['ONEOK']

In cluster OMC, the following companies are present:
['Omnicom Group']

In cluster ORLY, the following companies are present:
["O'Reilly Automotive"]

In cluster OXY, the following companies are present:
['Occidental Petroleum']

In cluster PBCT, the following companies are present:
["People's United Financial"]

In cluster PBI, the following companies are present:
['Pitney-Bowes']

In cluster PCAR, the following companies are present:
['PACCAR Inc.']

In cluster PCG, the following companies are present:
['PG&E Corp.']

In cluster PCLN, the following companies are present:
['Priceline.com Inc']

In cluster PEG, the following companies are present:
['Public Serv. Enterprise Inc.']

In cluster PEP, the following companies are present:
['PepsiCo Inc.']

In cluster PFE, the following companies are present:
['Pfizer Inc.']

In cluster PFG, the following companies are present:
['Principal Financial Group']

In cluster PG, the following companies are present:
['Procter & Gamble']

In cluster PGR, the following companies are present:
['Progressive Corp.']

In cluster PHM, the following companies are present:
['Pulte Homes Inc.']

In cluster PM, the following companies are present:
['Philip Morris International']

In cluster PNC, the following companies are present:
['PNC Financial Services']

In cluster PNR, the following companies are present:
['Pentair Ltd.']

In cluster PNW, the following companies are present:
['Pinnacle West Capital']

In cluster PPG, the following companies are present:
['PPG Industries']

In cluster PPL, the following companies are present:
['PPL Corp.']

In cluster PRU, the following companies are present:
['Prudential Financial']

In cluster PSX, the following companies are present:
['Phillips 66']

In cluster PWR, the following companies are present:
['Quanta Services Inc.']

In cluster PX, the following companies are present:
['Praxair Inc.']

In cluster PYPL, the following companies are present:
['PayPal']

In cluster R, the following companies are present:
['Ryder System']

In cluster RCL, the following companies are present:
['Royal Caribbean Cruises Ltd']

In cluster REGN, the following companies are present:
['Regeneron']

In cluster RHI, the following companies are present:
['Robert Half International']

In cluster ROP, the following companies are present:
['Roper Industries']

In cluster RRC, the following companies are present:
['Range Resources Corp.']

In cluster RSG, the following companies are present:
['Republic Services Inc']

In cluster SCG, the following companies are present:
['SCANA Corp']

In cluster SCHW, the following companies are present:
['Charles Schwab Corporation']

In cluster SE, the following companies are present:
['Spectra Energy Corp.']

In cluster SEE, the following companies are present:
['Sealed Air']

In cluster SHW, the following companies are present:
['Sherwin-Williams']

In cluster SLG, the following companies are present:
['SL Green Realty']

In cluster SNI, the following companies are present:
['Scripps Networks Interactive Inc.']

In cluster SO, the following companies are present:
['Southern Co.']

In cluster SPG, the following companies are present:
['Simon Property Group Inc']

In cluster SPGI, the following companies are present:
['S&P Global, Inc.']

In cluster SRCL, the following companies are present:
['Stericycle Inc']

In cluster SRE, the following companies are present:
['Sempra Energy']

In cluster STI, the following companies are present:
['SunTrust Banks']

In cluster STT, the following companies are present:
['State Street Corp.']

In cluster SWKS, the following companies are present:
['Skyworks Solutions']

In cluster SWN, the following companies are present:
['Southwestern Energy']

In cluster SYF, the following companies are present:
['Synchrony Financial']

In cluster SYK, the following companies are present:
['Stryker Corp.']

In cluster T, the following companies are present:
['AT&T Inc']

In cluster TAP, the following companies are present:
['Molson Coors Brewing Company']

In cluster TDC, the following companies are present:
['Teradata Corp.']

In cluster TGNA, the following companies are present:
['Tegna, Inc.']

In cluster TMK, the following companies are present:
['Torchmark Corp.']

In cluster TMO, the following companies are present:
['Thermo Fisher Scientific']

In cluster TRIP, the following companies are present:
['TripAdvisor']

In cluster TRV, the following companies are present:
['The Travelers Companies Inc.']

In cluster TSCO, the following companies are present:
['Tractor Supply Company']

In cluster TSN, the following companies are present:
['Tyson Foods']

In cluster TSO, the following companies are present:
['Tesoro Petroleum Co.']

In cluster TSS, the following companies are present:
['Total System Services']

In cluster TXN, the following companies are present:
['Texas Instruments']

In cluster UAA, the following companies are present:
['Under Armour']

In cluster UAL, the following companies are present:
['United Continental Holdings']

In cluster UDR, the following companies are present:
['UDR Inc']

In cluster UHS, the following companies are present:
['Universal Health Services, Inc.']

In cluster UNH, the following companies are present:
['United Health Group Inc.']

In cluster UNM, the following companies are present:
['Unum Group']

In cluster UNP, the following companies are present:
['Union Pacific']

In cluster UPS, the following companies are present:
['United Parcel Service']

In cluster UTX, the following companies are present:
['United Technologies']

In cluster VAR, the following companies are present:
['Varian Medical Systems']

In cluster VLO, the following companies are present:
['Valero Energy']

In cluster VMC, the following companies are present:
['Vulcan Materials']

In cluster VNO, the following companies are present:
['Vornado Realty Trust']

In cluster VRSK, the following companies are present:
['Verisk Analytics']

In cluster VRSN, the following companies are present:
['Verisign Inc.']

In cluster VRTX, the following companies are present:
['Vertex Pharmaceuticals Inc']

In cluster VTR, the following companies are present:
['Ventas Inc']

In cluster VZ, the following companies are present:
['Verizon Communications']

In cluster WAT, the following companies are present:
['Waters Corporation']

In cluster WEC, the following companies are present:
['Wec Energy Group Inc']

In cluster WFC, the following companies are present:
['Wells Fargo']

In cluster WHR, the following companies are present:
['Whirlpool Corp.']

In cluster WM, the following companies are present:
['Waste Management Inc.']

In cluster WMB, the following companies are present:
['Williams Cos.']

In cluster WU, the following companies are present:
['Western Union Co']

In cluster WY, the following companies are present:
['Weyerhaeuser Corp.']

In cluster WYN, the following companies are present:
['Wyndham Worldwide']

In cluster WYNN, the following companies are present:
['Wynn Resorts Ltd']

In cluster XEC, the following companies are present:
['Cimarex Energy']

In cluster XEL, the following companies are present:
['Xcel Energy Inc']

In cluster XL, the following companies are present:
['XL Capital']

In cluster XOM, the following companies are present:
['Exxon Mobil Corp.']

In cluster XRAY, the following companies are present:
['Dentsply Sirona']

In cluster XRX, the following companies are present:
['Xerox Corp.']

In cluster XYL, the following companies are present:
['Xylem Inc.']

In cluster YHOO, the following companies are present:
['Yahoo Inc.']

In cluster YUM, the following companies are present:
['Yum! Brands Inc']

In cluster ZBH, the following companies are present:
['Zimmer Biomet Holdings']

In cluster ZION, the following companies are present:
['Zions Bancorp']

In cluster ZTS, the following companies are present:
['Zoetis']

Edit

the following cell

to print

df2[df2['GICS Sub Industry'] == c1]["Security"].unique()

Cluster / Group by 'GICS Sub Industry':

In [223]:
## Failed Attempt to group by df2['GICS Sub Industry'].unique()
## Duplicated from previous cell:
## Complete the code to print the companies in each cluster
for cl in df2['GICS Sub Industry'].unique():
    print("In cluster {}, the following companies are present:".format(cl))
    print(df2[df2['GICS Sub Industry'] == cl]["Security"].unique())
    print()
In cluster Airlines, the following companies are present:
['American Airlines Group' 'Alaska Air Group Inc' 'Delta Air Lines'
 'Southwest Airlines' 'United Continental Holdings']

In cluster Pharmaceuticals, the following companies are present:
['AbbVie' 'Lilly (Eli) & Co.' 'Merck & Co.' 'Mylan N.V.' 'Pfizer Inc.'
 'Zoetis']

In cluster Health Care Equipment, the following companies are present:
['Abbott Laboratories' 'Baxter International Inc.' 'Bard (C.R.) Inc.'
 'Boston Scientific' 'Edwards Lifesciences' 'IDEXX Laboratories'
 'Intuitive Surgical Inc.' 'Stryker Corp.' 'Thermo Fisher Scientific'
 'Varian Medical Systems' 'Zimmer Biomet Holdings']

In cluster Application Software, the following companies are present:
['Adobe Systems Inc' 'Teradata Corp.']

In cluster Semiconductors, the following companies are present:
['Analog Devices, Inc.' 'Broadcom' 'First Solar Inc' 'Intel Corp.'
 'Skyworks Solutions' 'Texas Instruments']

In cluster Agricultural Products, the following companies are present:
['Archer-Daniels-Midland Co']

In cluster Data Processing & Outsourced Services, the following companies are present:
['Alliance Data Systems' 'PayPal']

In cluster MultiUtilities, the following companies are present:
['Ameren Corp' 'CMS Energy' 'CenterPoint Energy' 'Eversource Energy'
 'Exelon Corp.' 'NextEra Energy' 'PG&E Corp.' 'Pinnacle West Capital'
 'SCANA Corp' 'Sempra Energy' 'Xcel Energy Inc']

In cluster Electric Utilities, the following companies are present:
['American Electric Power' 'Dominion Resources' 'Duke Energy'
 'Consolidated Edison' "Edison Int'l" 'Entergy Corp.' 'FirstEnergy Corp'
 'Alliant Energy Corp' 'Public Serv. Enterprise Inc.' 'PPL Corp.'
 'Southern Co.' 'Wec Energy Group Inc']

In cluster Life & Health Insurance, the following companies are present:
['AFLAC Inc' 'MetLife Inc.' 'Torchmark Corp.']

In cluster Property & Casualty Insurance, the following companies are present:
['American International Group, Inc.' 'Allstate Corp' 'Chubb Limited'
 'Cincinnati Financial' 'Hartford Financial Svc.Gp.' 'Progressive Corp.'
 'The Travelers Companies Inc.' 'XL Capital']

In cluster REITs, the following companies are present:
['Apartment Investment & Mgmt' 'Boston Properties'
 'Crown Castle International Corp.' 'Equinix' 'Equity Residential'
 'Welltower Inc.' 'HCP Inc.' 'Host Hotels & Resorts'
 'Iron Mountain Incorporated' 'Kimco Realty' 'Simon Property Group Inc'
 'Vornado Realty Trust' 'Ventas Inc' 'Weyerhaeuser Corp.']

In cluster Multi-line Insurance, the following companies are present:
['Assurant Inc']

In cluster Insurance Brokers, the following companies are present:
['Arthur J. Gallagher & Co.' 'Aon plc' 'Marsh & McLennan']

In cluster Internet Software & Services, the following companies are present:
['Akamai Technologies Inc' 'Citrix Systems' 'eBay Inc.' 'Facebook'
 'Fidelity National Information Services' 'Fiserv Inc' 'Mastercard Inc.'
 'Netflix Inc.' 'Total System Services' 'Verisign Inc.' 'Western Union Co'
 'Yahoo Inc.']

In cluster Specialty Chemicals, the following companies are present:
['Albemarle Corp' 'Ecolab Inc.' 'Intl Flavors & Fragrances'
 'Sherwin-Williams']

In cluster Building Products, the following companies are present:
['Allegion' 'Fastenal Co' 'Fortune Brands Home & Security' 'Masco Corp.']

In cluster Biotechnology, the following companies are present:
['Alexion Pharmaceuticals' 'Amgen Inc' 'BIOGEN IDEC Inc.' 'Celgene Corp.'
 'Gilead Sciences' 'Regeneron' 'Vertex Pharmaceuticals Inc']

In cluster Semiconductor Equipment, the following companies are present:
['Applied Materials Inc']

In cluster Electrical Components & Equipment, the following companies are present:
['AMETEK Inc']

In cluster Asset Management & Custody Banks, the following companies are present:
['Affiliated Managers Group Inc' 'Ameriprise Financial' 'Invesco Ltd.'
 'Northern Trust Corp.']

In cluster Specialized REITs, the following companies are present:
['American Tower Corp A' 'Digital Realty Trust' 'Extra Space Storage']

In cluster Internet & Direct Marketing Retail, the following companies are present:
['Amazon.com Inc' 'Expedia Inc.' 'Priceline.com Inc' 'TripAdvisor']

In cluster Specialty Stores, the following companies are present:
['AutoNation Inc' 'Genuine Parts' "O'Reilly Automotive"]

In cluster Managed Health Care, the following companies are present:
['Anthem Inc.' 'CIGNA Corp.' 'Centene Corporation' 'Humana Inc.'
 'United Health Group Inc.']

In cluster Oil & Gas Exploration & Production, the following companies are present:
['Apache Corporation' 'Anadarko Petroleum Corp' 'Cabot Oil & Gas'
 'Concho Resources' 'Devon Energy Corp.' 'EOG Resources' 'EQT Corporation'
 'Marathon Oil Corp.' 'Noble Energy Inc' 'Newfield Exploration Co' 'ONEOK'
 'Occidental Petroleum' 'Range Resources Corp.' 'Southwestern Energy'
 'Williams Cos.' 'Cimarex Energy']

In cluster Electronic Components, the following companies are present:
['Amphenol Corp' 'Corning Inc.']

In cluster Aerospace & Defense, the following companies are present:
['Arconic Inc' 'Boeing Company' 'General Dynamics' 'Lockheed Martin Corp.']

In cluster Home Entertainment Software, the following companies are present:
['Activision Blizzard']

In cluster Residential REITs, the following companies are present:
['AvalonBay Communities, Inc.' 'Essex Property Trust, Inc.'
 'Mid-America Apartments' 'UDR Inc']

In cluster Water Utilities, the following companies are present:
['American Water Works Company Inc']

In cluster Consumer Finance, the following companies are present:
['American Express Co' 'Capital One Financial'
 'Discover Financial Services' 'Navient' 'Synchrony Financial']

In cluster Banks, the following companies are present:
['Bank of America Corp' 'BB&T Corporation'
 'The Bank of New York Mellon Corp.' 'Citigroup Inc.'
 'Huntington Bancshares' 'JPMorgan Chase & Co.' 'M&T Bank Corp.'
 'PNC Financial Services' 'SunTrust Banks' 'Wells Fargo']

In cluster Oil & Gas Equipment & Services, the following companies are present:
['Baker Hughes Inc' 'Halliburton Co.' 'National Oilwell Varco Inc.']

In cluster Metal & Glass Containers, the following companies are present:
['Ball Corp']

In cluster Health Care Distributors, the following companies are present:
['Bristol-Myers Squibb' 'Henry Schein' 'Waters Corporation']

In cluster Auto Parts & Equipment, the following companies are present:
['BorgWarner' 'Delphi Automotive']

In cluster Construction & Farm Machinery & Heavy Trucks, the following companies are present:
['Caterpillar Inc.' 'Deere & Co.' 'PACCAR Inc.']

In cluster Real Estate Services, the following companies are present:
['CBRE Group']

In cluster Hotels, Resorts & Cruise Lines, the following companies are present:
['Carnival Corp.' "Marriott Int'l." 'Royal Caribbean Cruises Ltd'
 'Wyndham Worldwide']

In cluster Fertilizers & Agricultural Chemicals, the following companies are present:
['CF Industries Holdings Inc' 'The Mosaic Company']

In cluster Regional Banks, the following companies are present:
['Citizens Financial Group' 'Comerica Inc.' 'Zions Bancorp']

In cluster Household Products, the following companies are present:
['Church & Dwight' 'Colgate-Palmolive' 'Kimberly-Clark']

In cluster Integrated Oil & Gas, the following companies are present:
['Chesapeake Energy' 'Chevron Corp.' 'Hess Corporation' 'Murphy Oil'
 'Exxon Mobil Corp.']

In cluster Air Freight & Logistics, the following companies are present:
['C. H. Robinson Worldwide' "Expeditors Int'l" 'United Parcel Service']

In cluster Cable & Satellite, the following companies are present:
['Charter Communications' 'Discovery Communications-A'
 'Discovery Communications-C']

In cluster Financial Exchanges & Data, the following companies are present:
['CME Group Inc.']

In cluster Restaurants, the following companies are present:
['Chipotle Mexican Grill' "McDonald's Corp." 'Yum! Brands Inc']

In cluster Industrial Machinery, the following companies are present:
['Cummins Inc.' 'Dover Corp.' 'Flowserve Corporation'
 'Illinois Tool Works' 'Pentair Ltd.']

In cluster Health Care Supplies, the following companies are present:
['The Cooper Companies' 'Dentsply Sirona']

In cluster Railroads, the following companies are present:
['CSX Corp.' 'Kansas City Southern' 'Norfolk Southern Corp.'
 'Union Pacific']

In cluster Integrated Telecommunications Services, the following companies are present:
['CenturyLink Inc' 'Frontier Communications' 'AT&T Inc'
 'Verizon Communications']

In cluster IT Consulting & Other Services, the following companies are present:
['Cognizant Technology Solutions' 'International Business Machines'
 'Xerox Corp.']

In cluster Drug Retail, the following companies are present:
['CVS Health']

In cluster Diversified Chemicals, the following companies are present:
['Du Pont (E.I.)' 'Eastman Chemical' 'FMC Corporation' 'LyondellBasell'
 'PPG Industries']

In cluster Health Care Facilities, the following companies are present:
['Quest Diagnostics' 'DaVita Inc.' 'HCA Holdings'
 'Laboratory Corp. of America Holding' 'Universal Health Services, Inc.']

In cluster Industrial Conglomerates, the following companies are present:
['Danaher Corp.' 'Eaton Corporation' "Honeywell Int'l Inc."
 'Jacobs Engineering Group' 'Leggett & Platt'
 'L-3 Communications Holdings' '3M Company' 'Quanta Services Inc.'
 'Ryder System' 'Roper Industries' 'Republic Services Inc'
 'Stericycle Inc' 'United Technologies' 'Xylem Inc.']

In cluster Broadcasting & Cable TV, the following companies are present:
['The Walt Disney Company' 'Scripps Networks Interactive Inc.']

In cluster Research & Consulting Services, the following companies are present:
['Dun & Bradstreet' 'Equifax Inc.' 'Nielsen Holdings' 'Verisk Analytics']

In cluster Soft Drinks, the following companies are present:
['Dr Pepper Snapple Group' 'Coca Cola Company' 'Monster Beverage'
 'PepsiCo Inc.']

In cluster Investment Banking & Brokerage, the following companies are present:
['E*Trade' 'Charles Schwab Corporation']

In cluster Automobile Manufacturers, the following companies are present:
['Ford Motor' 'General Motors']

In cluster Copper, the following companies are present:
['Freeport-McMoran Cp & Gld']

In cluster Electronic Equipment & Instruments, the following companies are present:
['FLIR Systems']

In cluster Diversified Commercial Services, the following companies are present:
['Fluor Corp.']

In cluster Retail REITs, the following companies are present:
['Federal Realty Investment Trust' 'General Growth Properties Inc.'
 'Macerich' 'Realty Income Corporation']

In cluster Consumer Electronics, the following companies are present:
['Garmin Ltd.']

In cluster Tires & Rubber, the following companies are present:
['Goodyear Tire & Rubber']

In cluster Industrial Materials, the following companies are present:
['Grainger (W.W.) Inc.']

In cluster Leisure Products, the following companies are present:
['Hasbro Inc.' 'Mattel Inc.']

In cluster Motorcycle Manufacturers, the following companies are present:
['Harley-Davidson']

In cluster Technology Hardware, Storage & Peripherals, the following companies are present:
['Hewlett Packard Enterprise']

In cluster Computer Hardware, the following companies are present:
['HP Inc.']

In cluster Packaged Foods & Meats, the following companies are present:
['Hormel Foods Corp.' 'The Hershey Company' 'Mondelez International'
 'Mead Johnson' 'McCormick & Co.' 'Tyson Foods']

In cluster Paper Packaging, the following companies are present:
['International Paper' 'Sealed Air']

In cluster Advertising, the following companies are present:
['Interpublic Group' 'Omnicom Group']

In cluster Trucking, the following companies are present:
['J. B. Hunt Transport Services']

In cluster Networking Equipment, the following companies are present:
['Juniper Networks']

In cluster Oil & Gas Refining & Marketing & Transportation, the following companies are present:
['Kinder Morgan' 'Marathon Petroleum' 'Phillips 66' 'Spectra Energy Corp.'
 'Tesoro Petroleum Co.' 'Valero Energy']

In cluster Homebuilding, the following companies are present:
['Lennar Corp.' 'Pulte Homes Inc.']

In cluster Distributors, the following companies are present:
['LKQ Corporation']

In cluster Multi-Sector Holdings, the following companies are present:
['Leucadia National Corp.']

In cluster Alternative Carriers, the following companies are present:
['Level 3 Communications']

In cluster Diversified Financial Services, the following companies are present:
["Moody's Corp" 'NASDAQ OMX Group' 'Principal Financial Group'
 'Prudential Financial' 'S&P Global, Inc.' 'State Street Corp.'
 'Unum Group']

In cluster Home Furnishings, the following companies are present:
['Mohawk Industries']

In cluster Construction Materials, the following companies are present:
['Martin Marietta Materials' 'Vulcan Materials']

In cluster Tobacco, the following companies are present:
['Altria Group Inc' 'Philip Morris International']

In cluster Life Sciences Tools & Services, the following companies are present:
['Mettler Toledo']

In cluster Gold, the following companies are present:
['Newmont Mining Corp. (Hldg. Co.)']

In cluster Steel, the following companies are present:
['Nucor Corp.']

In cluster Housewares & Specialties, the following companies are present:
['Newell Brands']

In cluster Thrifts & Mortgage Finance, the following companies are present:
["People's United Financial"]

In cluster Technology, Hardware, Software and Supplies, the following companies are present:
['Pitney-Bowes']

In cluster Personal Products, the following companies are present:
['Procter & Gamble']

In cluster Industrial Gases, the following companies are present:
['Praxair Inc.']

In cluster Human Resource & Employment Services, the following companies are present:
['Robert Half International']

In cluster Office REITs, the following companies are present:
['SL Green Realty']

In cluster Brewers, the following companies are present:
['Molson Coors Brewing Company']

In cluster Publishing, the following companies are present:
['Tegna, Inc.']

In cluster Specialty Retail, the following companies are present:
['Tractor Supply Company']

In cluster Apparel, Accessories & Luxury Goods, the following companies are present:
['Under Armour']

In cluster Household Appliances, the following companies are present:
['Whirlpool Corp.']

In cluster Environmental Services, the following companies are present:
['Waste Management Inc.']

In cluster Casinos & Gaming, the following companies are present:
['Wynn Resorts Ltd']

In [224]:
df2.groupby(["HC_segments", "GICS Sector"])['Security'].count()
Out[224]:
HC_segments  GICS Sector                
0            Consumer Discretionary         40
             Consumer Staples               19
             Energy                         30
             Financials                     49
             Health Care                    40
             Industrials                    53
             Information Technology         33
             Materials                      20
             Real Estate                    27
             Telecommunications Services     5
             Utilities                      24
Name: Security, dtype: int64

Attempt to get matplotlib pyplot figure numbers¶

matplotlib pyplot font size¶
ax = plt.subplot(111, xlabel='x', ylabel='y', title='title')
for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +
             ax.get_xticklabels() + ax.get_yticklabels()):
    item.set_fontsize(20)

Reference: How to change the font size on a matplotlib plot

how to get plt number¶

plt.gcf().number How do you get the current figure number in Python's matplotlib?

In [225]:
plt.gcf().number
Out[225]:
1
<Figure size 800x550 with 0 Axes>

Get the list of figures in Matplotlib

In [226]:
plt.get_fignums()
Out[226]:
[]

How to get subplots of matplotlib Figure?

In [227]:
allaxes = fig.get_axes()
In [228]:
allaxes
Out[228]:
[<Axes: title={'center': 'Dendrogram (Single Linkage)'}>,
 <Axes: title={'center': 'Dendrogram (Complete Linkage)'}>,
 <Axes: title={'center': 'Dendrogram (Average Linkage)'}>,
 <Axes: title={'center': 'Dendrogram (Centroid Linkage)'}>,
 <Axes: title={'center': 'Dendrogram (Ward Linkage)'}>,
 <Axes: title={'center': 'Dendrogram (Weighted Linkage)'}>]
ax = plt.subplot(111, xlabel='x', ylabel='y', title='title')
for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +
             ax.get_xticklabels() + ax.get_yticklabels()):
    item.set_fontsize(20)

How to change the font size on a matplotlib plot

In [229]:
# unused:
# https://stackoverflow.com/questions/49572582/distplot-got-an-unexpected-keyword-argument-figsize
# Solves figsize:
# https://stackoverflow.com/questions/31594549/how-to-change-the-figure-size-of-a-seaborn-axes-or-figure-level-plot
# plt.figure(figsize=(3,3))
# ax=plt.subplot(111, title='title')
# for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +
#              ax.get_xticklabels() + ax.get_yticklabels()):
#     item.set_fontsize(9)
# plt.subplot(figsize=(4,4))
In [230]:
# ax=plt.subplot(title='title')
# for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +
#              ax.get_xticklabels() + ax.get_yticklabels()):
#     item.set_fontsize(20)

fix bug: adjust text size:

  • save boxplot to ax var for each of 11 subplots
  • set_fontsize to 15 for each subplot

as follows:

replace:

ax=sns.boxplot(data=df2, x="HC_segments", y=variable)

with:

ax=sns.boxplot(data=df2, x="HC_segments", y=variable)
for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +
            ax.get_xticklabels() + ax.get_yticklabels()):
    item.set_fontsize(15)
In [231]:
plt.figure(figsize=(30, 8))
plt.suptitle("Boxplot of numerical variables for each cluster")

for i, variable in enumerate(num_col):
    plt.subplot(1, 12, i + 1)
    ax=sns.boxplot(data=df2, x="HC_segments", y=variable)
    for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +
                ax.get_xticklabels() + ax.get_yticklabels()):
        item.set_fontsize(15)

plt.tight_layout(pad=2.0)
plt.gcf().number
Out[231]:
1

K-means vs Hierarchical Clustering¶

You compare several things, like:

  • Which clustering technique took less time for execution?
  • Which clustering technique gave you more distinct clusters, or are they the same?
  • How many observations are there in the similar clusters of both algorithms?
  • How many clusters are obtained as the appropriate number of clusters from both algorithms?

You can also mention any differences or similarities you obtained in the cluster profiles from both the clustering techniques.

In [ ]:
 
Technical Overview:¶

Estimated Notebook Runtime: 2m 19s

Actionable Insights and Recommendations¶

  • It is assumed that the dataset given contains simulated stock prices, or prices cherry-picked from different times, rather than real prices taken from a single time period for the following reasons:
  1. Upon analyzing the first 10 stocks (AAL to AFL) in the dataset, no time period in history could be found using Google Finance for which the stock prices mentioned would coincide.
  2. Alliance Data Systems (ADS in stock_data.csv dataset) (now Bread Financial NYSE: BFH, since: 23 Mar 2022) never reached the Price of $276.570007 given in the dataset, with the max actually achieved of about $245.23 on around 24 April 2015.
  3. For the stocks AAL to ADM: in order for prices to be roughly in range: the pricing period would have to be in the window from 2004 to 2016.
  4. AFLAC Inc (AFL) only had the possibility of being in a price range containing $58.27 after June 2017.
  5. Thus, from process of elimination, since the 2 time ranges: (2004 to 2016), and, (post June 2017) are mutually exclusive, the stock prices given are not real prices taken from a single time period in history.
  • Therefore, in order to provide real predictive power for real prices in terms of buying and selling stocks and actionable insights and recommendations on same, the dataset used would have to be substituted with actual historic stock data from a single time range.

For the purposes of this project:¶